Skip to content

Commit

Permalink
Improved flow for enabling/disabling music mid-game.
Browse files Browse the repository at this point in the history
  • Loading branch information
kondrak committed Jul 14, 2019
1 parent 224afb8 commit 9e5c54a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion client/snd_miniaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ void Miniaudio_Play(int track, qboolean looping)
loopcounter = 0;
playTrack = track;
playLooping = looping;
paused = false;
trackFinished = false;

if (Cvar_VariableValue("cd_nocd"))
Expand Down Expand Up @@ -307,7 +308,16 @@ void Miniaudio_Update(void)
else
{
enabled = true;
Miniaudio_Resume();
int track = atoi(cl.configstrings[CS_CDTRACK]);
if (!paused || playTrack != track)
{
if ((playTrack == 0 && !playLooping) || (playTrack > 0 && playTrack != track))
Miniaudio_Play(track, true);
else
Miniaudio_Play(playTrack, playLooping);
}
else
Miniaudio_Resume();
}
}

Expand Down

0 comments on commit 9e5c54a

Please sign in to comment.