diff options
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alu.cpp | 11 | ||||
-rw-r--r-- | alc/voice.h | 7 |
2 files changed, 10 insertions, 8 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index b29ac977..862ba9a2 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -1689,7 +1689,7 @@ void ProcessVoiceChanges(ALCcontext *ctx) if(oldvoice->mSourceID.exchange(0u, std::memory_order_relaxed) != 0u) { /* Otherwise, set the voice to stopping if it's not already (it - * would already be if paused), and play the new voice as + * might already be, if paused), and play the new voice as * appropriate. */ ALvoice::State oldvstate{ALvoice::Playing}; @@ -1697,9 +1697,9 @@ void ProcessVoiceChanges(ALCcontext *ctx) std::memory_order_relaxed, std::memory_order_acquire); ALvoice *voice{cur->mVoice}; - if(oldvstate == ALvoice::Playing) - voice->mPlayState.store(ALvoice::Playing, std::memory_order_release); - voice->mPendingChange.store(false, std::memory_order_release); + voice->mPlayState.store( + (oldvstate == ALvoice::Playing) ? ALvoice::Playing : ALvoice::Stopped, + std::memory_order_release); } oldvoice->mPendingChange.store(false, std::memory_order_release); } @@ -1753,7 +1753,8 @@ void ProcessContexts(ALCdevice *device, const ALuint SamplesToDo) for(ALvoice *voice : voices) { const ALvoice::State vstate{voice->mPlayState.load(std::memory_order_acquire)}; - if(vstate != ALvoice::Stopped) voice->mix(vstate, ctx, SamplesToDo); + if(vstate != ALvoice::Stopped && vstate != ALvoice::Pending) + voice->mix(vstate, ctx, SamplesToDo); } /* Process effects. */ diff --git a/alc/voice.h b/alc/voice.h index 88e15c2e..eb89d932 100644 --- a/alc/voice.h +++ b/alc/voice.h @@ -192,9 +192,10 @@ struct ALvoiceProps : public ALvoicePropsBase { struct ALvoice { enum State { - Stopped = 0, - Playing = 1, - Stopping = 2 + Stopped, + Playing, + Stopping, + Pending }; std::atomic<ALvoiceProps*> mUpdate{nullptr}; |