Hi,

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.

Please consider applying this patch.

-- 
Sebastian Thorarensen


---
 doc/user.xml                        |   10 ++++++++++
 src/decoder/MikmodDecoderPlugin.cxx |    5 +++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/user.xml b/doc/user.xml
index 61d02c1..b3ab8d4 100644
--- a/doc/user.xml
+++ b/doc/user.xml
@@ -978,6 +978,16 @@ systemctl start mpd.socket</programlisting>
             <tbody>
               <row>
                 <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>
                 </entry>
                 <entry>
diff --git a/src/decoder/MikmodDecoderPlugin.cxx 
b/src/decoder/MikmodDecoderPlugin.cxx
index fb82eb7..6f2fd03 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());
-- 
1.7.8.6

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Musicpd-dev-team mailing list
Musicpd-dev-team@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team

Reply via email to