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 1aa4035594
commit abb67d35e3
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, // Kills playing sounds at start of level,
// determines music if any, changes music. // determines music if any, changes music.
// //
void S_Start(void) void S_StartEx(boolean reset)
{ {
if (mapmusflags & MUSIC_RELOADRESET) if (mapmusflags & MUSIC_RELOADRESET)
{ {
@ -1617,7 +1617,7 @@ void S_Start(void)
mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK); mapmusflags = (mapheaderinfo[gamemap-1]->mustrack & MUSIC_TRACKMASK);
} }
if (cv_resetmusic.value) if (cv_resetmusic.value || reset)
S_StopMusic(); S_StopMusic();
S_ChangeMusic(mapmusname, mapmusflags, true); S_ChangeMusic(mapmusname, mapmusflags, true);
} }

View file

@ -114,7 +114,8 @@ void S_InitSfxChannels(INT32 sfxVolume);
// //
void S_StopSounds(void); void S_StopSounds(void);
void S_ClearSfx(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. // 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); Mix_Timidity_addToPathList(cv_miditimiditypath.string);
if (restart) if (restart)
S_Start(); S_StartEx(true);
} }
static void MidiSoundfontPath_Onchange(void) static void MidiSoundfontPath_Onchange(void)
@ -114,7 +114,7 @@ static void MidiSoundfontPath_Onchange(void)
if (rw != NULL) { if (rw != NULL) {
SDL_RWclose(rw); SDL_RWclose(rw);
Mix_SetSoundFonts(cv_midisoundfontpath.string); Mix_SetSoundFonts(cv_midisoundfontpath.string);
S_Start(); S_StartEx(true);
} }
} }
} }