Reset MIDI music properly on settings change

* Added reset flag to S_Start (now S_StartEx)
This commit is contained in:
mazmazz 2018-09-01 11:37:53 -04:00
parent c8a9edca8d
commit 7fbe97a3d2
3 changed files with 6 additions and 5 deletions

View file

@ -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);
}

View file

@ -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.

View file

@ -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);
}
}
}