Merge branch 'music-sdlmixerx' into musicplus-sdlmixerx

This commit is contained in:
mazmazz 2018-09-01 11:38:26 -04:00
commit 1681e6cc00
3 changed files with 6 additions and 17 deletions

View file

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

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

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