Commit b6ac249c authored by Sebastian Thorarensen's avatar Sebastian Thorarensen Committed by Max Kellermann

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.
parent 5e103b5f
...@@ -17,6 +17,7 @@ ver 0.18 (2012/??/??) ...@@ -17,6 +17,7 @@ ver 0.18 (2012/??/??)
- flac: support FLAC files inside archives - flac: support FLAC files inside archives
- opus: new decoder plugin for the Opus codec - opus: new decoder plugin for the Opus codec
- vorbis: skip 16 bit quantisation, provide float samples - vorbis: skip 16 bit quantisation, provide float samples
- mikmod: add "loop" configuration parameter
- mp4ff: obsolete plugin removed - mp4ff: obsolete plugin removed
* encoder: * encoder:
- opus: new encoder plugin for the Opus codec - opus: new encoder plugin for the Opus codec
......
...@@ -978,6 +978,16 @@ systemctl start mpd.socket</programlisting> ...@@ -978,6 +978,16 @@ systemctl start mpd.socket</programlisting>
<tbody> <tbody>
<row> <row>
<entry> <entry>
<varname>loop</varname>
<parameter>yes|no</parameter>
</entry>
<entry>
Allow backward loops in modules. Default is
<parameter>no</parameter>.
</entry>
</row>
<row>
<entry>
<varname>sample_rate</varname> <varname>sample_rate</varname>
</entry> </entry>
<entry> <entry>
......
...@@ -104,6 +104,7 @@ static MDRIVER drv_mpd = { ...@@ -104,6 +104,7 @@ static MDRIVER drv_mpd = {
VC_VoiceRealVolume VC_VoiceRealVolume
}; };
static bool mikmod_loop;
static unsigned mikmod_sample_rate; static unsigned mikmod_sample_rate;
static bool static bool
...@@ -111,6 +112,7 @@ mikmod_decoder_init(const config_param &param) ...@@ -111,6 +112,7 @@ mikmod_decoder_init(const config_param &param)
{ {
static char params[] = ""; static char params[] = "";
mikmod_loop = param.GetBlockValue("loop", false);
mikmod_sample_rate = param.GetBlockValue("sample_rate", 44100u); mikmod_sample_rate = param.GetBlockValue("sample_rate", 44100u);
if (!audio_valid_sample_rate(mikmod_sample_rate)) if (!audio_valid_sample_rate(mikmod_sample_rate))
FormatFatalError("Invalid sample rate in line %d: %u", FormatFatalError("Invalid sample rate in line %d: %u",
...@@ -161,8 +163,7 @@ mikmod_decoder_file_decode(struct decoder *decoder, const char *path_fs) ...@@ -161,8 +163,7 @@ mikmod_decoder_file_decode(struct decoder *decoder, const char *path_fs)
return; return;
} }
/* Prevent module from looping forever */ handle->loop = mikmod_loop;
handle->loop = 0;
const AudioFormat audio_format(mikmod_sample_rate, SampleFormat::S16, 2); const AudioFormat audio_format(mikmod_sample_rate, SampleFormat::S16, 2);
assert(audio_format.IsValid()); assert(audio_format.IsValid());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment