aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-12-16 02:12:18 -0800
committerChris Robinson <[email protected]>2020-12-16 02:12:18 -0800
commit02be0149f1bd682b368663f9c6491f1b59fd4acc (patch)
treec910d2c5ac359f1478f9f17fc1a925452e9d500f /alc
parentc96b50fb657f6760636becab70dbbdaa1bfb2974 (diff)
Send stop events when stopping paused voices
Diffstat (limited to 'alc')
-rw-r--r--alc/alu.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp
index 7b7f5006..790b8485 100644
--- a/alc/alu.cpp
+++ b/alc/alu.cpp
@@ -1594,14 +1594,17 @@ void ProcessVoiceChanges(ALCcontext *ctx)
{
voice->mCurrentBuffer.store(nullptr, std::memory_order_relaxed);
voice->mLoopBuffer.store(nullptr, std::memory_order_relaxed);
- voice->mSourceID.store(0u, std::memory_order_relaxed);
+ /* A source ID indicates the voice was playing or paused, which
+ * gets a reset/stop event.
+ */
+ sendevt = voice->mSourceID.exchange(0u, std::memory_order_relaxed) != 0u;
Voice::State oldvstate{Voice::Playing};
- sendevt = voice->mPlayState.compare_exchange_strong(oldvstate, Voice::Stopping,
+ voice->mPlayState.compare_exchange_strong(oldvstate, Voice::Stopping,
std::memory_order_relaxed, std::memory_order_acquire);
voice->mPendingChange.store(false, std::memory_order_release);
}
- /* AL_INITIAL state change events are always sent, even if the
- * voice is already stopped or even if there is no voice.
+ /* Reset state change events are always sent, even if the voice is
+ * already stopped or even if there is no voice.
*/
sendevt |= (cur->mState == VChangeState::Reset);
}
@@ -1638,7 +1641,7 @@ void ProcessVoiceChanges(ALCcontext *ctx)
}
else if(cur->mState == VChangeState::Restart)
{
- /* Changing a voice offset never sends a source change event. */
+ /* Restarting a voice never sends a source change event. */
Voice *oldvoice{cur->mOldVoice};
oldvoice->mCurrentBuffer.store(nullptr, std::memory_order_relaxed);
oldvoice->mLoopBuffer.store(nullptr, std::memory_order_relaxed);