From 45e82379a417e7c9f16c0367e32d749d867f5e89 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 8 Jan 2020 06:40:58 -0800 Subject: Make sure an unmixable source is properly stopped --- alc/voice.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/alc/voice.cpp b/alc/voice.cpp index 022d0b91..c3735acb 100644 --- a/alc/voice.cpp +++ b/alc/voice.cpp @@ -542,7 +542,15 @@ void ALvoice::mix(const State vstate, ALCcontext *Context, const ALuint SamplesT const ALuint NumChannels{mNumChannels}; const ALuint SampleSize{mSampleSize}; const ALuint increment{mStep}; - if(increment < 1) return; + if UNLIKELY(increment < 1) + { + /* If the voice is supposed to be stopping but can't be mixed, just + * stop it before bailing. + */ + if(vstate == ALvoice::Stopping) + mPlayState.store(ALvoice::Stopped, std::memory_order_release); + return; + } ASSUME(NumChannels > 0); ASSUME(SampleSize > 0); -- cgit v1.2.3