diff options
author | Chris Robinson <[email protected]> | 2019-09-01 15:28:33 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-01 15:28:33 -0700 |
commit | 727217ce0a9765270551ad6e10a25ee0b7fb74e6 (patch) | |
tree | b198517a0cf7051678281ea78396da4af6820cfc /al | |
parent | d15950f383cfdff64d464721b02b9f9b8cb4a0f2 (diff) |
Ensure AL_STOPPED state change events are sent
With explicit calls to alSourceStop on a playing or paused source
Diffstat (limited to 'al')
-rw-r--r-- | al/source.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/al/source.cpp b/al/source.cpp index 08e4bff6..010dee1c 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -2974,7 +2974,11 @@ START_API_FUNC BackendLockGuard __{*device->Backend}; auto stop_source = [&context](ALsource *source) -> void { + /* Get the source state before clearing from the voice, so we know what + * state the source+voice was actually in. + */ ALvoice *voice{GetSourceVoice(source, context.get())}; + const ALenum oldstate{GetSourceState(source, voice)}; if(voice != nullptr) { voice->mCurrentBuffer.store(nullptr, std::memory_order_relaxed); @@ -2986,7 +2990,6 @@ START_API_FUNC std::memory_order_acq_rel, std::memory_order_acquire); voice = nullptr; } - ALenum oldstate{GetSourceState(source, voice)}; if(oldstate != AL_INITIAL && oldstate != AL_STOPPED) { source->state = AL_STOPPED; @@ -3048,7 +3051,7 @@ START_API_FUNC std::memory_order_acq_rel, std::memory_order_acquire); voice = nullptr; } - if(GetSourceState(source, voice) != AL_INITIAL) + if(source->state != AL_INITIAL) { source->state = AL_INITIAL; SendStateChangeEvent(context.get(), source->id, AL_INITIAL); |