From c84879717f41cdb4bf58510120f7a3adeb0d88ee Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Thu, 20 Jan 2022 07:02:00 +1100 Subject: [PATCH] [client] audio: fix failure to properly handle restart if draining --- client/src/audio.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/audio.c b/client/src/audio.c index 840dd98b..1375af9d 100644 --- a/client/src/audio.c +++ b/client/src/audio.c @@ -179,10 +179,16 @@ void audio_playbackStart(int channels, int sampleRate, PSAudioFormat format, static int lastChannels = 0; static int lastSampleRate = 0; - if (STREAM_ACTIVE(audio.playback.state)) + if (audio.playback.state != STREAM_STATE_STOP) { if (channels == lastChannels && sampleRate == lastSampleRate) + { + // if the stream was still draining and the format matches, return the + // stream to the run state + if (audio.playback.state == STREAM_STATE_DRAIN) + audio.playback.state = STREAM_STATE_RUN; goto no_change; + } playbackStopNL(); }