Skip to content

Commit

Permalink
Fix music changes between areas
Browse files Browse the repository at this point in the history
  • Loading branch information
N00byKing committed Apr 10, 2022
1 parent b855310 commit 1cf298d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion desktop_version/src/Music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ class MusicTrack
FAudioSourceVoice_FlushSourceBuffers(musicVoice);
FAudioVoice_DestroyVoice(musicVoice);
musicVoice = NULL;
paused = true;
}
}

Expand All @@ -370,14 +371,21 @@ class MusicTrack
if (!IsHalted())
{
FAudioSourceVoice_Stop(musicVoice, 0, FAUDIO_COMMIT_NOW);
paused = true;
}
}

static bool IsPaused()
{
return paused || IsHalted();
}

static void Resume()
{
if (!IsHalted())
{
FAudioSourceVoice_Start(musicVoice, 0, FAUDIO_COMMIT_NOW);
paused = false;
}
}

Expand Down Expand Up @@ -405,6 +413,7 @@ class MusicTrack
Uint8* read_buf = NULL;
bool shouldloop;
bool valid;
bool paused;

static FAudioSourceVoice* musicVoice;

Expand Down Expand Up @@ -1130,7 +1139,7 @@ void musicclass::resumeef(void)

bool musicclass::halted(void)
{
return MusicTrack::IsHalted();
return MusicTrack::IsPaused();
}

void musicclass::updatemutestate(void)
Expand Down

0 comments on commit 1cf298d

Please sign in to comment.