diff --git a/src/m_menu.c b/src/m_menu.c index 40f49c415..3814afcc8 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -527,7 +527,6 @@ static INT32 M_ShiftChar(INT32 ch) // Pretty and consistent ^u^ // See also G_GetGametypeColor. // - static INT32 highlightflags, recommendedflags, warningflags; inline static void M_GetGametypeColor(void) diff --git a/src/s_sound.c b/src/s_sound.c index 8e9ff6efb..5d50e73dc 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -273,6 +273,12 @@ void S_RegisterSoundStuff(void) CV_RegisterVar(&cv_gamesounds); CV_RegisterVar(&cv_gamedigimusic); +#ifdef HAVE_FLUIDSYNTH + CV_RegisterVar(&cv_midisoundfontpath); + CV_RegisterVar(&cv_midichorus); + CV_RegisterVar(&cv_midireverb); +#endif + CV_RegisterVar(&cv_samesoundlimit); // bird music stuff diff --git a/src/s_sound.h b/src/s_sound.h index 2bd61af40..89092c891 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -56,6 +56,12 @@ extern consvar_t cv_amigatype; boolean S_MapMusPlaying(void); +#ifdef HAVE_FLUIDSYNTH +extern consvar_t cv_midisoundfontpath; +extern consvar_t cv_midichorus; +extern consvar_t cv_midireverb; +#endif + //bird music stuff extern consvar_t cv_invincmusicfade; extern consvar_t cv_growmusicfade; diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index 4260e144b..ba6294b53 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -131,7 +131,27 @@ static void MidiSoundfontPath_Onchange(void) SDL_UnlockAudioStream(audio_stream); } +static void MidiChorus_OnChange(void) +{ + if (synth_settings != NULL) + { + fluid_settings_setnum(synth_settings, "synth.chorus.active", cv_midichorus.value > 0); + fluid_settings_setnum(synth_settings, "synth.chorus.level", FixedToFloat(cv_midichorus.value)); + } +} + +static void MidiReverb_OnChange(void) +{ + if (synth_settings != NULL) + { + fluid_settings_setnum(synth_settings, "synth.reverb.active", cv_midireverb.value > 0); + fluid_settings_setnum(synth_settings, "synth.reverb.level", FixedToFloat(cv_midireverb.value)); + } +} + consvar_t cv_midisoundfontpath = CVAR_INIT ("midisoundfont", "sf2/GeneralUser-GS.sf2", "Which MIDI soundfont to use", CV_CALL|CV_NOINIT|CV_SAVE, NULL, MidiSoundfontPath_Onchange); +consvar_t cv_midichorus = CVAR_INIT ("midichorus", "1", "Controls the chorus level of MIDI playback; setting this too high might cause some instruments to be overexposed", CV_CALL|CV_SAVE|CV_FLOAT, CV_Unsigned, MidiChorus_OnChange); +consvar_t cv_midireverb = CVAR_INIT ("midireverb", "1", "Controls the reverb level of MIDI playback; setting this too high might cause notes to be drawn out", CV_CALL|CV_SAVE|CV_FLOAT, CV_Unsigned, MidiReverb_OnChange); #endif //FIXME: this is not how it should be lol @@ -1079,8 +1099,10 @@ void I_InitMusic(void) synth_settings = new_fluid_settings(); fluid_settings_setnum(synth_settings, "synth.gain", 1.0f); fluid_settings_setnum(synth_settings, "synth.sample-rate", virtual_spec.freq); - fluid_settings_setnum(synth_settings, "synth.chorus.level", 0.0f); - fluid_settings_setnum(synth_settings, "synth.reverb.level", 0.0f); + fluid_settings_setnum(synth_settings, "synth.chorus.active", cv_midichorus.value > 0); + fluid_settings_setnum(synth_settings, "synth.chorus.level", cv_midichorus.value); + fluid_settings_setnum(synth_settings, "synth.reverb.active", cv_midireverb.value > 0); + fluid_settings_setnum(synth_settings, "synth.reverb.level", cv_midireverb.value); synth = new_fluid_synth(synth_settings); if (synth == NULL) {