aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-10-26 16:48:38 +0100
committerMax Kellermann <max@duempel.org>2015-10-26 16:56:55 +0100
commit08f77c2b607a32e818ee0e0375adec840eb521c0 (patch)
treedbd37ce9e84f72ec2effac5afbe10ab4bd77ce3c
parent6269abbcc8dbb5f9709267013fad7f54bbc8ad14 (diff)
downloadmpd-08f77c2b607a32e818ee0e0375adec840eb521c0.tar.gz
mpd-08f77c2b607a32e818ee0e0375adec840eb521c0.tar.xz
mpd-08f77c2b607a32e818ee0e0375adec840eb521c0.zip
decoder/gme: add option "accuracy"
-rw-r--r--NEWS1
-rw-r--r--doc/user.xml22
-rw-r--r--src/decoder/plugins/GmeDecoderPlugin.cxx25
3 files changed, 47 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 4f1171630..c5d581a7b 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,7 @@ ver 0.20 (not yet released)
* decoder
- ffmpeg: support ReplayGain and MixRamp
- ffmpeg: support stream tags
+ - gme: add option "accuracy"
- mad: reduce memory usage while scanning tags
- mpcdec: read the bit rate
* playlist
diff --git a/doc/user.xml b/doc/user.xml
index 3d4a70241..f66f6e397 100644
--- a/doc/user.xml
+++ b/doc/user.xml
@@ -1749,6 +1749,28 @@ buffer_size: 16384</programlisting>
Video game music file emulator based on <ulink
url="https://bitbucket.org/mpyne/game-music-emu/wiki/Home"><application>game-music-emu</application></ulink>.
</para>
+
+ <informaltable>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Setting</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <varname>accuracy</varname>
+ <parameter>yes|no</parameter>
+ </entry>
+ <entry>
+ Enable more accurate sound emulation.
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
</section>
<section>
diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx
index dccf21d43..ca8677ef8 100644
--- a/src/decoder/plugins/GmeDecoderPlugin.cxx
+++ b/src/decoder/plugins/GmeDecoderPlugin.cxx
@@ -20,6 +20,7 @@
#include "config.h"
#include "GmeDecoderPlugin.hxx"
#include "../DecoderAPI.hxx"
+#include "config/Block.cxx"
#include "CheckAudioFormat.hxx"
#include "tag/TagHandler.hxx"
#include "fs/Path.hxx"
@@ -52,6 +53,23 @@ struct GmeContainerPath {
unsigned track;
};
+#if GME_VERSION >= 0x000600
+static int gme_accuracy;
+#endif
+
+static bool
+gme_plugin_init(gcc_unused const ConfigBlock &block)
+{
+#if GME_VERSION >= 0x000600
+ auto accuracy = block.GetBlockParam("accuracy");
+ gme_accuracy = accuracy != nullptr
+ ? (int)accuracy->GetBoolValue()
+ : -1;
+#endif
+
+ return true;
+}
+
gcc_pure
static unsigned
ParseSubtuneName(const char *base)
@@ -123,6 +141,11 @@ gme_file_decode(Decoder &decoder, Path path_fs)
return;
}
+#if GME_VERSION >= 0x000600
+ if (gme_accuracy >= 0)
+ gme_enable_accuracy(emu, gme_accuracy);
+#endif
+
gme_info_t *ti;
gme_err = gme_track_info(emu, &ti, container.track);
if (gme_err != nullptr) {
@@ -274,7 +297,7 @@ static const char *const gme_suffixes[] = {
extern const struct DecoderPlugin gme_decoder_plugin;
const struct DecoderPlugin gme_decoder_plugin = {
"gme",
- nullptr,
+ gme_plugin_init,
nullptr,
nullptr,
gme_file_decode,