aboutsummaryrefslogtreecommitdiffstats
path: root/alc/alc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r--alc/alc.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 54162d14..89c836d0 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -2082,18 +2082,6 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
}
}
- /* Clear any pre-existing voice property structs, in case the number of
- * auxiliary sends is changing. Active sources will have updates
- * respecified in UpdateAllSourceProps.
- */
- VoicePropsItem *vprops{context->mFreeVoiceProps.exchange(nullptr, std::memory_order_acq_rel)};
- while(vprops)
- {
- VoicePropsItem *next = vprops->next.load(std::memory_order_relaxed);
- delete vprops;
- vprops = next;
- }
-
auto voicelist = context->getVoicesSpan();
for(Voice *voice : voicelist)
{
@@ -2108,7 +2096,8 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
SendParams{});
}
- delete voice->mUpdate.exchange(nullptr, std::memory_order_acq_rel);
+ if(VoicePropsItem *props{voice->mUpdate.exchange(nullptr, std::memory_order_relaxed)})
+ AtomicReplaceHead(context->mFreeVoiceProps, props);
/* Force the voice to stopped if it was stopping. */
Voice::State vstate{Voice::Stopping};
@@ -2119,6 +2108,9 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
voice->prepare(device);
}
+ /* Clear all voice props to let them get allocated again. */
+ context->mVoicePropClusters.clear();
+ context->mFreeVoiceProps.store(nullptr, std::memory_order_relaxed);
srclock.unlock();
context->mPropsDirty.test_and_clear(std::memory_order_release);
@@ -2173,6 +2165,9 @@ bool ResetDeviceParams(ALCdevice *device, const int *attrList)
vchg = next;
ctx->mCurrentVoiceChange.store(vchg, std::memory_order_release);
+ ctx->mVoicePropClusters.clear();
+ ctx->mFreeVoiceProps.store(nullptr, std::memory_order_relaxed);
+
ctx->mVoiceClusters.clear();
ctx->allocVoices(std::max<size_t>(256,
ctx->mActiveVoiceCount.load(std::memory_order_relaxed)));