aboutsummaryrefslogtreecommitdiffstats
path: root/alc/alc.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-07-15 06:14:25 -0700
committerChris Robinson <[email protected]>2022-07-15 06:14:25 -0700
commit0f4679981b575cc76158126dec7d9bdda3ba1c29 (patch)
tree77e9176befdeb963e7dd791fc50df3db34f789bc /alc/alc.cpp
parent0b9fc03545f7418be89bb9a8901b342ce84a5f67 (diff)
Allocate EffectSlots in clusters
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r--alc/alc.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 3ce14dac..4a142ca6 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -2224,6 +2224,20 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
context->mWetBuffers.end(), buffer_not_in_use);
context->mWetBuffers.erase(wetbuffer_iter, context->mWetBuffers.end());
+ /* Clear out unused effect slot clusters. */
+ auto slot_cluster_not_in_use = [](ContextBase::EffectSlotCluster &cluster)
+ {
+ for(size_t i{0};i < ContextBase::EffectSlotClusterSize;++i)
+ {
+ if(cluster[i].InUse)
+ return false;
+ }
+ return true;
+ };
+ auto slotcluster_iter = std::remove_if(context->mEffectSlotClusters.begin(),
+ context->mEffectSlotClusters.end(), slot_cluster_not_in_use);
+ context->mEffectSlotClusters.erase(slotcluster_iter, context->mEffectSlotClusters.end());
+
if(ALeffectslot *slot{context->mDefaultSlot.get()})
{
aluInitEffectPanning(slot->mSlot, context);