aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/MikmodDecoderPlugin.cxx
diff options
context:
space:
mode:
authorSebastian Thorarensen <sebth@naju.se>2013-10-18 04:12:36 +0200
committerMax Kellermann <max@duempel.org>2013-10-18 14:23:24 +0200
commitb6ac249c3c009dc45ba758d2dbe6b2959215959b (patch)
tree0628ff9923c16d740361bbe5b846b28069d2163d /src/decoder/MikmodDecoderPlugin.cxx
parent5e103b5fb7aa8da5000ecd25815f979df45cffa6 (diff)
downloadmpd-b6ac249c3c009dc45ba758d2dbe6b2959215959b.tar.gz
mpd-b6ac249c3c009dc45ba758d2dbe6b2959215959b.tar.xz
mpd-b6ac249c3c009dc45ba758d2dbe6b2959215959b.zip
decoder/mikmod: Add loop configuration parameter
This patch allows the user to configure the mikmod decoder plugin to loop modules. It adds a configuration parameter to the mikmod decoder called "loop" which can be "no" (the old behaviour, default) or "yes" to allow modules to use backward loops.
Diffstat (limited to '')
-rw-r--r--src/decoder/MikmodDecoderPlugin.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/decoder/MikmodDecoderPlugin.cxx b/src/decoder/MikmodDecoderPlugin.cxx
index fb82eb732..6f2fd039d 100644
--- a/src/decoder/MikmodDecoderPlugin.cxx
+++ b/src/decoder/MikmodDecoderPlugin.cxx
@@ -104,6 +104,7 @@ static MDRIVER drv_mpd = {
VC_VoiceRealVolume
};
+static bool mikmod_loop;
static unsigned mikmod_sample_rate;
static bool
@@ -111,6 +112,7 @@ mikmod_decoder_init(const config_param &param)
{
static char params[] = "";
+ mikmod_loop = param.GetBlockValue("loop", false);
mikmod_sample_rate = param.GetBlockValue("sample_rate", 44100u);
if (!audio_valid_sample_rate(mikmod_sample_rate))
FormatFatalError("Invalid sample rate in line %d: %u",
@@ -161,8 +163,7 @@ mikmod_decoder_file_decode(struct decoder *decoder, const char *path_fs)
return;
}
- /* Prevent module from looping forever */
- handle->loop = 0;
+ handle->loop = mikmod_loop;
const AudioFormat audio_format(mikmod_sample_rate, SampleFormat::S16, 2);
assert(audio_format.IsValid());