diff --git a/src/s_sound.c b/src/s_sound.c index 0e7c6671e..890b4435a 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -1728,7 +1728,7 @@ boolean S_FadeOutStopMusic(UINT32 ms) // 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) { @@ -1738,7 +1738,7 @@ void S_Start(void) mapmusposition = mapheaderinfo[gamemap-1]->muspos; } - if (cv_resetmusic.value) + if (cv_resetmusic.value || reset) S_StopMusic(); S_ChangeMusicAdvanced(mapmusname, mapmusflags, true, mapmusposition, 0, 0); } diff --git a/src/s_sound.h b/src/s_sound.h index 6ff77f5b8..d2b790973 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 63b1045d7..1be031e3e 100644 --- a/src/sdl/mixer_sound.c +++ b/src/sdl/mixer_sound.c @@ -110,13 +110,7 @@ static void Midiplayer_Onchange(void) Mix_Timidity_addToPathList(cv_miditimiditypath.string); if (restart) - { - // HACK: Need to set cv_resetmusic to reload MIDI music - INT32 resetmusicval = cv_resetmusic.value; - cv_resetmusic.value = 1; - S_Start(); - cv_resetmusic.value = resetmusicval; - } + S_StartEx(true); } static void MidiSoundfontPath_Onchange(void) @@ -129,15 +123,9 @@ static void MidiSoundfontPath_Onchange(void) // check if file exists; menu calls this method at every keystroke SDL_RWops *rw = SDL_RWFromFile(cv_midisoundfontpath.string, "r"); if (rw != NULL) { - INT32 resetmusicval = cv_resetmusic.value; - SDL_RWclose(rw); Mix_SetSoundFonts(cv_midisoundfontpath.string); - - // HACK: Need to set cv_resetmusic to reload MIDI music - cv_resetmusic.value = 1; - S_Start(); - cv_resetmusic.value = resetmusicval; + S_StartEx(true); } } }