diff options
author | Chris Robinson <[email protected]> | 2019-01-09 18:29:22 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-01-09 18:29:22 -0800 |
commit | e7d77f5caa424597ab8023f92f00bfa50f8b78f8 (patch) | |
tree | c6a4796a02dd0e3349ab697f108335ce22794a47 /Alc/alu.cpp | |
parent | 30184613a53c9eb013fee10403aa9cd97d4ea5e1 (diff) |
Use a vector for ALeffectslotArray
Diffstat (limited to 'Alc/alu.cpp')
-rw-r--r-- | Alc/alu.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp index 42e31b88..55e4e5c7 100644 --- a/Alc/alu.cpp +++ b/Alc/alu.cpp @@ -28,6 +28,7 @@ #include <cmath> #include <limits> +#include <numeric> #include <algorithm> #include <functional> @@ -1437,9 +1438,9 @@ void ProcessParamUpdates(ALCcontext *ctx, const ALeffectslotArray *slots) { bool cforce{CalcContextParams(ctx)}; bool force{CalcListenerParams(ctx) || cforce}; - std::for_each(slots->slot, slots->slot+slots->count, - [ctx,cforce,&force](ALeffectslot *slot) -> void - { force |= CalcEffectSlotParams(slot, ctx, cforce); } + force = std::accumulate(slots->begin(), slots->end(), force, + [ctx,cforce](bool force, ALeffectslot *slot) -> bool + { return CalcEffectSlotParams(slot, ctx, cforce) | force; } ); std::for_each(ctx->Voices, ctx->Voices+ctx->VoiceCount.load(std::memory_order_acquire), @@ -1463,7 +1464,7 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo) ProcessParamUpdates(ctx, auxslots); /* Clear auxiliary effect slot mixing buffers. */ - std::for_each(auxslots->slot, auxslots->slot+auxslots->count, + std::for_each(auxslots->begin(), auxslots->end(), [SamplesToDo](ALeffectslot *slot) -> void { std::for_each(slot->WetBuffer, slot->WetBuffer+slot->NumChannels, @@ -1491,9 +1492,9 @@ void ProcessContext(ALCcontext *ctx, const ALsizei SamplesToDo) ); /* Process effects. */ - if(auxslots->count < 1) return; - auto slots = auxslots->slot; - auto slots_end = slots + auxslots->count; + if(auxslots->size() < 1) return; + auto slots = auxslots->data(); + auto slots_end = slots + auxslots->size(); /* First sort the slots into scratch storage, so that effects come before * their effect target (or their targets' target). |