Backwards compatibility with older libopenmpt versions than 0.5
This commit is contained in:
		@@ -18,6 +18,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "OpenmptDecoderPlugin.hxx"
 | 
					#include "OpenmptDecoderPlugin.hxx"
 | 
				
			||||||
 | 
					#include "decoder/Features.h"
 | 
				
			||||||
#include "ModCommon.hxx"
 | 
					#include "ModCommon.hxx"
 | 
				
			||||||
#include "../DecoderAPI.hxx"
 | 
					#include "../DecoderAPI.hxx"
 | 
				
			||||||
#include "input/InputStream.hxx"
 | 
					#include "input/InputStream.hxx"
 | 
				
			||||||
@@ -43,7 +44,9 @@ static bool openmpt_override_mptm_interp_filter;
 | 
				
			|||||||
static int openmpt_volume_ramping;
 | 
					static int openmpt_volume_ramping;
 | 
				
			||||||
static bool openmpt_sync_samples;
 | 
					static bool openmpt_sync_samples;
 | 
				
			||||||
static bool openmpt_emulate_amiga;
 | 
					static bool openmpt_emulate_amiga;
 | 
				
			||||||
 | 
					#ifdef HAVE_LIBOPENMPT_VERSION_0_5
 | 
				
			||||||
static std::string_view openmpt_emulate_amiga_type;
 | 
					static std::string_view openmpt_emulate_amiga_type;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool
 | 
					static bool
 | 
				
			||||||
openmpt_decoder_init(const ConfigBlock &block)
 | 
					openmpt_decoder_init(const ConfigBlock &block)
 | 
				
			||||||
@@ -54,7 +57,9 @@ openmpt_decoder_init(const ConfigBlock &block)
 | 
				
			|||||||
	openmpt_volume_ramping = block.GetBlockValue("volume_ramping", -1);
 | 
						openmpt_volume_ramping = block.GetBlockValue("volume_ramping", -1);
 | 
				
			||||||
	openmpt_sync_samples = block.GetBlockValue("sync_samples", true);
 | 
						openmpt_sync_samples = block.GetBlockValue("sync_samples", true);
 | 
				
			||||||
	openmpt_emulate_amiga = block.GetBlockValue("emulate_amiga", true);
 | 
						openmpt_emulate_amiga = block.GetBlockValue("emulate_amiga", true);
 | 
				
			||||||
 | 
					#ifdef HAVE_LIBOPENMPT_VERSION_0_5
 | 
				
			||||||
	openmpt_emulate_amiga_type = block.GetBlockValue("emulate_amiga_type", "auto");
 | 
						openmpt_emulate_amiga_type = block.GetBlockValue("emulate_amiga_type", "auto");
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -83,9 +88,14 @@ mod_decode(DecoderClient &client, InputStream &is)
 | 
				
			|||||||
		mod.set_render_param(mod.RENDER_INTERPOLATIONFILTER_LENGTH, 0);
 | 
							mod.set_render_param(mod.RENDER_INTERPOLATIONFILTER_LENGTH, 0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	mod.set_render_param(mod.RENDER_VOLUMERAMPING_STRENGTH, openmpt_volume_ramping);
 | 
						mod.set_render_param(mod.RENDER_VOLUMERAMPING_STRENGTH, openmpt_volume_ramping);
 | 
				
			||||||
 | 
					#ifdef HAVE_LIBOPENMPT_VERSION_0_5
 | 
				
			||||||
	mod.ctl_set_boolean("seek.sync_samples", openmpt_sync_samples);
 | 
						mod.ctl_set_boolean("seek.sync_samples", openmpt_sync_samples);
 | 
				
			||||||
	mod.ctl_set_boolean("render.resampler.emulate_amiga", openmpt_emulate_amiga);
 | 
						mod.ctl_set_boolean("render.resampler.emulate_amiga", openmpt_emulate_amiga);
 | 
				
			||||||
	mod.ctl_set_text("render.resampler.emulate_amiga_type", openmpt_emulate_amiga_type);
 | 
						mod.ctl_set_text("render.resampler.emulate_amiga_type", openmpt_emulate_amiga_type);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
						mod.ctl_set("seek.sync_samples", std::to_string(openmpt_sync_samples));
 | 
				
			||||||
 | 
						mod.ctl_set("render.resampler.emulate_amiga", std::to_string(openmpt_emulate_amiga));
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	static constexpr AudioFormat audio_format(OPENMPT_SAMPLE_RATE, SampleFormat::FLOAT, 2);
 | 
						static constexpr AudioFormat audio_format(OPENMPT_SAMPLE_RATE, SampleFormat::FLOAT, 2);
 | 
				
			||||||
	assert(audio_format.IsValid());
 | 
						assert(audio_format.IsValid());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -110,6 +110,7 @@ endif
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
libopenmpt_dep = dependency('libopenmpt', required: get_option('openmpt'))
 | 
					libopenmpt_dep = dependency('libopenmpt', required: get_option('openmpt'))
 | 
				
			||||||
decoder_features.set('ENABLE_OPENMPT', libopenmpt_dep.found())
 | 
					decoder_features.set('ENABLE_OPENMPT', libopenmpt_dep.found())
 | 
				
			||||||
 | 
					decoder_features.set('HAVE_LIBOPENMPT_VERSION_0_5', libopenmpt_dep.version().version_compare('>= 0.5'))
 | 
				
			||||||
if libopenmpt_dep.found()
 | 
					if libopenmpt_dep.found()
 | 
				
			||||||
  decoder_plugins_sources += [
 | 
					  decoder_plugins_sources += [
 | 
				
			||||||
    'OpenmptDecoderPlugin.cxx',
 | 
					    'OpenmptDecoderPlugin.cxx',
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user