xrick: Fix a race condition that could result in audio stopping

get_more() can disable audio when there's nothing more to genreate
but that can get called (and "fail") _before_ we set the flag
that audio is turned on.  If this occurs, we will incorrecly
set the "audio on" flag after the failure which will prevent
the mixer from being re-started.

(We're at the mercy of thread scheduling)

Change-Id: I4f6c50a71c7ad685ff45f775e7e4b1c61b8b7777
This commit is contained in:
Solomon Peachy 2026-03-29 18:02:09 -04:00
parent f235443ba1
commit e677895e29

View file

@ -222,8 +222,8 @@ void syssnd_update(void)
if (!isAudioPlaying && fillCount > 0)
{
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
isAudioPlaying = true;
rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
}
}
}