diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2020-01-08 06:40:58 -0800 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2020-01-08 06:40:58 -0800 |
commit | 45e82379a417e7c9f16c0367e32d749d867f5e89 (patch) | |
tree | 5dbbc0753db558399d051895220e6880878f8834 | |
parent | 84f65c1883bf98708ca22bded6cc1a66ddbf4219 (diff) |
Make sure an unmixable source is properly stopped
-rw-r--r-- | alc/voice.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
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); |