aboutsummaryrefslogtreecommitdiffstats
path: root/al/source.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-12-17 04:07:00 -0800
committerChris Robinson <[email protected]>2021-12-17 04:07:00 -0800
commitc9537abfb1a9d1c94d6bf9aa0e6cfa2cda1ae94b (patch)
tree294ac9a7fa7a921e2ae9320cc59ed8ca9a1117e5 /al/source.cpp
parent21bdea776a1fca9f009470c6e5753cf78e208593 (diff)
Allocate voice properties in clusters
Diffstat (limited to 'al/source.cpp')
-rw-r--r--al/source.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/al/source.cpp b/al/source.cpp
index 4a2aaf35..cf95f7a4 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -100,15 +100,15 @@ void UpdateSourceProps(const ALsource *source, Voice *voice, ALCcontext *context
/* Get an unused property container, or allocate a new one as needed. */
VoicePropsItem *props{context->mFreeVoiceProps.load(std::memory_order_acquire)};
if(!props)
- props = new VoicePropsItem{};
- else
{
- VoicePropsItem *next;
- do {
- next = props->next.load(std::memory_order_relaxed);
- } while(context->mFreeVoiceProps.compare_exchange_weak(props, next,
- std::memory_order_acq_rel, std::memory_order_acquire) == 0);
+ context->allocVoiceProps();
+ props = context->mFreeVoiceProps.load(std::memory_order_acquire);
}
+ VoicePropsItem *next;
+ do {
+ next = props->next.load(std::memory_order_relaxed);
+ } while(unlikely(context->mFreeVoiceProps.compare_exchange_weak(props, next,
+ std::memory_order_acq_rel, std::memory_order_acquire) == false));
props->Pitch = source->Pitch;
props->Gain = source->Gain;