aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alc.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-03-09 16:48:07 -0800
committerChris Robinson <[email protected]>2019-03-09 16:48:07 -0800
commitef0f3351321a7488e60faa838a4628cfecf230b8 (patch)
treea28d31d1eb4fdf785a6f2fceeaa7cface4a02973 /Alc/alc.cpp
parentcde4500e24a8f5067d87711bf778cde99f26d990 (diff)
Add a Stopping state for voices
This currently doesn't do much, except have the mixer progress it to Stopped. It's valid to have without a source or buffers, and in the future will allow fading out when a source is paused or stopped.
Diffstat (limited to 'Alc/alc.cpp')
-rw-r--r--Alc/alc.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index 9bba1b52..9891fec5 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -2148,7 +2148,11 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
{
delete voice->Update.exchange(nullptr, std::memory_order_acq_rel);
- if(voice->SourceID.load(std::memory_order_acquire) == 0u)
+ /* Force the voice to stopped if it was stopping. */
+ ALvoice::State vstate{ALvoice::Stopping};
+ voice->PlayState.compare_exchange_strong(vstate, ALvoice::Stopped,
+ std::memory_order_acquire, std::memory_order_acquire);
+ if(voice->SourceID.load(std::memory_order_relaxed) == 0u)
return;
if(device->AvgSpeakerDist > 0.0f)
@@ -2625,8 +2629,8 @@ void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends)
voice->SourceID.store(old_voice->SourceID.load(std::memory_order_relaxed),
std::memory_order_relaxed);
- voice->Playing.store(old_voice->Playing.load(std::memory_order_relaxed),
- std::memory_order_relaxed);
+ voice->PlayState.store(old_voice->PlayState.load(std::memory_order_relaxed),
+ std::memory_order_relaxed);
voice->Props = old_voice->Props;
/* Clear extraneous property set sends. */