aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
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);