From 08f77c2b607a32e818ee0e0375adec840eb521c0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 26 Oct 2015 16:48:38 +0100 Subject: decoder/gme: add option "accuracy" --- src/decoder/plugins/GmeDecoderPlugin.cxx | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/decoder/plugins') 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, -- cgit v1.2.3