Add repeat count setting to openmpt decoder

This commit is contained in:
GrimReaperFloof 2021-05-26 23:16:05 +02:00
parent dc5b9d989b
commit 6f64fa070d
2 changed files with 5 additions and 0 deletions

View File

@ -505,6 +505,8 @@ Module player based on `libopenmpt <https://lib.openmpt.org>`_.
* - Setting
- Description
* - **repeat_count**
- Set how many times the module repeats. -1: repeat forever. 0: play once, repeat zero times (the default). n>0: play once and repeat n times after that.
* - **stereo_separation**
- Sets the stereo separation. The supported value range is [0,200]. Defaults to 100.
* - **interpolation_filter 0|1|2|4|8**

View File

@ -38,6 +38,7 @@ static constexpr Domain openmpt_domain("openmpt");
static constexpr size_t OPENMPT_FRAME_SIZE = 4096;
static constexpr int32_t OPENMPT_SAMPLE_RATE = 48000;
static int openmpt_repeat_count;
static int openmpt_stereo_separation;
static int openmpt_interpolation_filter;
static bool openmpt_override_mptm_interp_filter;
@ -51,6 +52,7 @@ static std::string_view openmpt_emulate_amiga_type;
static bool
openmpt_decoder_init(const ConfigBlock &block)
{
openmpt_repeat_count = block.GetBlockValue("repeat_count", 0);
openmpt_stereo_separation = block.GetBlockValue("stereo_separation", 100);
openmpt_interpolation_filter = block.GetBlockValue("interpolation_filter", 0);
openmpt_override_mptm_interp_filter = block.GetBlockValue("override_mptm_interp_filter", false);
@ -79,6 +81,7 @@ mod_decode(DecoderClient &client, InputStream &is)
openmpt::module mod(buffer.data(), buffer.size());
/* alter settings */
mod.set_repeat_count(openmpt_repeat_count);
mod.set_render_param(mod.RENDER_STEREOSEPARATION_PERCENT, openmpt_stereo_separation);
mod.set_render_param(mod.RENDER_INTERPOLATIONFILTER_LENGTH, openmpt_interpolation_filter);
if (!openmpt_override_mptm_interp_filter && mod.get_metadata("type") == "mptm") {