diff options
author | Max Kellermann <max@duempel.org> | 2009-11-14 02:03:03 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-14 02:24:42 +0100 |
commit | 1648c7aa5baf86583b057943337e4fade8616022 (patch) | |
tree | 8ead3e7f7237b2aa640127685f0f9dd8404878e1 /src/decoder | |
parent | edaf017908f153091f0e3da073729bc2522a56f4 (diff) | |
download | mpd-1648c7aa5baf86583b057943337e4fade8616022.tar.gz mpd-1648c7aa5baf86583b057943337e4fade8616022.tar.xz mpd-1648c7aa5baf86583b057943337e4fade8616022.zip |
decoder/mikmod: sample rate is configurable
The new option "sample_rate" sets the sample rate for libmikmod.
Diffstat (limited to 'src/decoder')
-rw-r--r-- | src/decoder/mikmod_plugin.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/decoder/mikmod_plugin.c b/src/decoder/mikmod_plugin.c index 720196333..74eb48ee9 100644 --- a/src/decoder/mikmod_plugin.c +++ b/src/decoder/mikmod_plugin.c @@ -100,11 +100,20 @@ static MDRIVER drv_mpd = { VC_VoiceRealVolume }; +static unsigned mikmod_sample_rate; + static bool -mikmod_decoder_init(G_GNUC_UNUSED const struct config_param *param) +mikmod_decoder_init(const struct config_param *param) { + unsigned sample_rate; static char params[] = ""; + mikmod_sample_rate = config_get_block_unsigned(param, "sample_rate", + 44100); + if (!audio_valid_sample_rate(mikmod_sample_rate)) + g_error("Invalid sample rate in line %d: %u", + param->line, sample_rate); + md_device = 0; md_reverb = 0; @@ -112,7 +121,7 @@ mikmod_decoder_init(G_GNUC_UNUSED const struct config_param *param) MikMod_RegisterAllLoaders(); md_pansep = 64; - md_mixfreq = 44100; + md_mixfreq = mikmod_sample_rate; md_mode = (DMODE_SOFT_MUSIC | DMODE_INTERP | DMODE_STEREO | DMODE_16BITS); @@ -155,7 +164,7 @@ mikmod_decoder_file_decode(struct decoder *decoder, const char *path_fs) /* Prevent module from looping forever */ handle->loop = 0; - audio_format_init(&audio_format, 44100, 16, 2); + audio_format_init(&audio_format, mikmod_sample_rate, 16, 2); assert(audio_format_valid(&audio_format)); secPerByte = |