1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Fix music changes between areas

This commit is contained in:
N00byKing 2022-04-10 21:50:15 +02:00 committed by Misa Elizabeth Kai
parent b8553107ff
commit e16c1557fa

View file

@ -357,6 +357,7 @@ end:
FAudioSourceVoice_FlushSourceBuffers(musicVoice); FAudioSourceVoice_FlushSourceBuffers(musicVoice);
FAudioVoice_DestroyVoice(musicVoice); FAudioVoice_DestroyVoice(musicVoice);
musicVoice = NULL; musicVoice = NULL;
paused = true;
} }
} }
@ -370,14 +371,21 @@ end:
if (!IsHalted()) if (!IsHalted())
{ {
FAudioSourceVoice_Stop(musicVoice, 0, FAUDIO_COMMIT_NOW); FAudioSourceVoice_Stop(musicVoice, 0, FAUDIO_COMMIT_NOW);
paused = true;
} }
} }
static bool IsPaused()
{
return paused || IsHalted();
}
static void Resume() static void Resume()
{ {
if (!IsHalted()) if (!IsHalted())
{ {
FAudioSourceVoice_Start(musicVoice, 0, FAUDIO_COMMIT_NOW); FAudioSourceVoice_Start(musicVoice, 0, FAUDIO_COMMIT_NOW);
paused = false;
} }
} }
@ -406,6 +414,7 @@ end:
bool shouldloop; bool shouldloop;
bool valid; bool valid;
static bool paused;
static FAudioSourceVoice* musicVoice; static FAudioSourceVoice* musicVoice;
static void refillReserve(FAudioVoiceCallback* callback, void* ctx) static void refillReserve(FAudioVoiceCallback* callback, void* ctx)
@ -560,7 +569,7 @@ end:
return (result * 60 + val) * samplerate_hz; return (result * 60 + val) * samplerate_hz;
} }
}; };
bool MusicTrack::paused = false;
FAudioSourceVoice* MusicTrack::musicVoice = NULL; FAudioSourceVoice* MusicTrack::musicVoice = NULL;
musicclass::musicclass(void) musicclass::musicclass(void)
@ -1130,7 +1139,7 @@ void musicclass::resumeef(void)
bool musicclass::halted(void) bool musicclass::halted(void)
{ {
return MusicTrack::IsHalted(); return MusicTrack::IsPaused();
} }
void musicclass::updatemutestate(void) void musicclass::updatemutestate(void)