From 7fbe97a3d220e6b69715d47560ea82a6a27c442b Mon Sep 17 00:00:00 2001 From: mazmazz Date: Sat, 1 Sep 2018 11:37:53 -0400 Subject: [PATCH] Reset MIDI music properly on settings change * Added reset flag to S_Start (now S_StartEx) --- src/s_sound.c | 4 ++-- src/s_sound.h | 3 ++- src/sdl/mixer_sound.c | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/s_sound.c b/src/s_sound.c index 7bfd0e62d..1e8839e29 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1608,7 +1608,7 @@ void S_SetMusicVolume(INT32 digvolume, INT32 seqvolume) // Kills playing sounds at start of level, // determines music if any, changes music. // -void S_Start(void) +void S_StartEx(boolean reset) { if (mapmusflags & MUSIC_RELOADRESET) { @@ -1617,7 +1617,7 @@ void S_Start(void) mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK); } - if (cv_resetmusic.value) + if (cv_resetmusic.value || reset) S_StopMusic(); S_ChangeMusic(mapmusname, mapmusflags, true); } diff --git a/src/s_sound.h b/src/s_sound.h index 94bb27f93..01b95e307 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -114,7 +114,8 @@ void S_InitSfxChannels(INT32 sfxVolume); // void S_StopSounds(void); void S_ClearSfx(void); -void S_Start(void); +void S_StartEx(boolean reset); +#define S_Start() S_StartEx(false) // // Basically a W_GetNumForName that adds "ds" at the beginning of the string. Returns a lumpnum. diff --git a/src/sdl/mixer_sound.c b/src/sdl/mixer_sound.c index 133a8ff84..73778e5ac 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -99,7 +99,7 @@ static void Midiplayer_Onchange(void) Mix_Timidity_addToPathList(cv_miditimiditypath.string); if (restart) - S_Start(); + S_StartEx(true); } static void MidiSoundfontPath_Onchange(void) @@ -114,7 +114,7 @@ static void MidiSoundfontPath_Onchange(void) if (rw != NULL) { SDL_RWclose(rw); Mix_SetSoundFonts(cv_midisoundfontpath.string); - S_Start(); + S_StartEx(true); } } }