From f903c1ea11d9b3175c3075bbbf3e6c636adea2f9 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 13 Mar 2022 10:38:36 -0700 Subject: Make sure FX slots that aren't made active are disabled --- al/source.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'al/source.cpp') diff --git a/al/source.cpp b/al/source.cpp index f985da7a..f46b24fb 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -3966,14 +3966,13 @@ void ALsource::eax_set_fx_slots() { eax_uses_primary_id_ = false; eax_has_active_fx_slots_ = false; + eax_active_fx_slots_.fill(false); - for (auto i = 0; i < EAX_MAX_FXSLOTS; ++i) + for(const auto& eax_active_fx_slot_id : eax_.active_fx_slots.guidActiveFXSlots) { - const auto& eax_active_fx_slot_id = eax_.active_fx_slots.guidActiveFXSlots[i]; - auto fx_slot_index = EaxFxSlotIndex{}; - if (eax_active_fx_slot_id == EAX_PrimaryFXSlotID) + if(eax_active_fx_slot_id == EAX_PrimaryFXSlotID) { eax_uses_primary_id_ = true; fx_slot_index = eax_al_context_->eax_get_primary_fx_slot_index(); @@ -3983,19 +3982,17 @@ void ALsource::eax_set_fx_slots() fx_slot_index = eax_active_fx_slot_id; } - if (fx_slot_index.has_value()) + if(fx_slot_index.has_value()) { eax_has_active_fx_slots_ = true; eax_active_fx_slots_[*fx_slot_index] = true; } } - for (auto i = 0u; i < EAX_MAX_FXSLOTS; ++i) + for(auto i = 0u;i < eax_active_fx_slots_.size();++i) { - if (!eax_active_fx_slots_[i]) - { + if(!eax_active_fx_slots_[i]) eax_set_al_source_send(nullptr, i, EaxAlLowPassParam{1.0f, 1.0f}); - } } } -- cgit v1.2.3