aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-08 11:53:51 -0800
committerChris Robinson <[email protected]>2023-12-08 11:53:51 -0800
commit112ad405df27b5a20d7a578321b592be2d4d8eaf (patch)
treea3401c88cdcd70dee030697cec885adfc6330d57 /alc
parent040c172cdf186c9ccfb0642aa9ac598f115bb46b (diff)
Use a fixed array for fixed-size clusters
Diffstat (limited to 'alc')
-rw-r--r--alc/alc.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp
index 62f798f2..3fcdcc3e 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -1628,9 +1628,10 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
std::unique_lock<std::mutex> slotlock{context->mEffectSlotLock};
/* Clear out unused effect slot clusters. */
- auto slot_cluster_not_in_use = [](ContextBase::EffectSlotCluster &cluster)
+ auto slot_cluster_not_in_use = [](ContextBase::EffectSlotCluster &clusterptr)
{
- for(size_t i{0};i < ContextBase::EffectSlotClusterSize;++i)
+ const auto cluster = al::span{*clusterptr};
+ for(size_t i{0};i < cluster.size();++i)
{
if(cluster[i].InUse)
return false;
@@ -1644,13 +1645,14 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
/* Free all wet buffers. Any in use will be reallocated with an updated
* configuration in aluInitEffectPanning.
*/
- for(auto&& slots : context->mEffectSlotClusters)
+ for(auto& clusterptr : context->mEffectSlotClusters)
{
- for(size_t i{0};i < ContextBase::EffectSlotClusterSize;++i)
+ const auto cluster = al::span{*clusterptr};
+ for(size_t i{0};i < cluster.size();++i)
{
- slots[i].mWetBuffer.clear();
- slots[i].mWetBuffer.shrink_to_fit();
- slots[i].Wet.Buffer = {};
+ cluster[i].mWetBuffer.clear();
+ cluster[i].mWetBuffer.shrink_to_fit();
+ cluster[i].Wet.Buffer = {};
}
}