From 3123925fa86c6963ae2471f1fd8a05b45202bff7 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 21 Dec 2012 23:58:33 +0000 Subject: [PATCH] - Fixed: Changing fluid_chorus and fluid_reverb did not take effect until the next song started. SVN r3994 (trunk) --- src/sound/i_musicinterns.h | 2 ++ src/sound/music_fluidsynth_mididevice.cpp | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/sound/i_musicinterns.h b/src/sound/i_musicinterns.h index 576597dc2..3c1134c63 100644 --- a/src/sound/i_musicinterns.h +++ b/src/sound/i_musicinterns.h @@ -373,6 +373,8 @@ protected: int (STACK_ARGS *fluid_settings_setint)(fluid_settings_t *, const char *, int); int (STACK_ARGS *fluid_settings_getstr)(fluid_settings_t *, const char *, char **); int (STACK_ARGS *fluid_settings_getint)(fluid_settings_t *, const char *, int *); + void (STACK_ARGS *fluid_synth_set_reverb_on)(fluid_synth_t *, int); + void (STACK_ARGS *fluid_synth_set_chorus_on)(fluid_synth_t *, int); int (STACK_ARGS *fluid_synth_set_interp_method)(fluid_synth_t *, int, int); int (STACK_ARGS *fluid_synth_set_polyphony)(fluid_synth_t *, int); int (STACK_ARGS *fluid_synth_get_polyphony)(fluid_synth_t *); diff --git a/src/sound/music_fluidsynth_mididevice.cpp b/src/sound/music_fluidsynth_mididevice.cpp index 77b830cc3..b9143d140 100644 --- a/src/sound/music_fluidsynth_mididevice.cpp +++ b/src/sound/music_fluidsynth_mididevice.cpp @@ -544,7 +544,16 @@ void FluidSynthMIDIDevice::FluidSettingInt(const char *setting, int value) } else if (0 == fluid_settings_setint(FluidSettings, setting, value)) { - Printf("Faild to set %s to %d.\n", setting, value); + Printf("Failed to set %s to %d.\n", setting, value); + } + // fluid_settings_setint succeeded; update these settings in the running synth, too + else if (strcmp(setting, "synth.reverb.active") == 0) + { + fluid_synth_set_reverb_on(FluidSynth, value); + } + else if (strcmp(setting, "synth.chorus.active") == 0) + { + fluid_synth_set_chorus_on(FluidSynth, value); } } @@ -648,6 +657,8 @@ bool FluidSynthMIDIDevice::LoadFluidSynth() { (void **)&fluid_settings_setint, "fluid_settings_setint" }, { (void **)&fluid_settings_getstr, "fluid_settings_getstr" }, { (void **)&fluid_settings_getint, "fluid_settings_getint" }, + { (void **)&fluid_synth_set_reverb_on, "fluid_synth_set_reverb_on" }, + { (void **)&fluid_synth_set_chorus_on, "fluid_synth_set_chorus_on" }, { (void **)&fluid_synth_set_interp_method, "fluid_synth_set_interp_method" }, { (void **)&fluid_synth_set_polyphony, "fluid_synth_set_polyphony" }, { (void **)&fluid_synth_get_polyphony, "fluid_synth_get_polyphony" },