diff options
author | Chris Robinson <[email protected]> | 2020-02-21 04:29:32 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-02-21 04:29:32 -0800 |
commit | 0694df901437568ce4699ae3c8a3e003eea0ceb7 (patch) | |
tree | d09309a6d7225d83cc9f11eb939e1054cedf5a3f /alc | |
parent | 9887c6971de48c3a86e3dddf24031ebb986b495a (diff) |
Handle playing and pausing with VoiceChanges
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alu.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index 6d67756c..9039fb9c 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -1643,6 +1643,19 @@ void ProcessVoiceChanges(ALCcontext *ctx) } success |= (cur->mState == AL_INITIAL); } + else if(cur->mState == AL_PAUSED) + { + ALvoice *voice{cur->mVoice}; + ALvoice::State oldvstate{ALvoice::Playing}; + success = voice->mPlayState.compare_exchange_strong(oldvstate, ALvoice::Stopping, + std::memory_order_release, std::memory_order_acquire); + } + else if(cur->mState == AL_PLAYING) + { + ALvoice *voice{cur->mVoice}; + voice->mPlayState.store(ALvoice::Playing, std::memory_order_release); + success = true; + } if(success && (enabledevt&EventType_SourceStateChange) && cur->mSourceID != 0) SendSourceStateEvent(ctx, cur->mSourceID, cur->mState); } while((next=cur->mNext.load(std::memory_order_acquire))); |