diff options
author | Chris Robinson <chris.kcat@gmail.com> | 2020-02-25 06:39:03 -0800 |
---|---|---|
committer | Chris Robinson <chris.kcat@gmail.com> | 2020-02-25 06:39:03 -0800 |
commit | 795c4fcecc05132e550fa8b797e129823b230cdf (patch) | |
tree | c0932e6e80ad561067e2467a372fa4e7060948cd /alc/alc.cpp | |
parent | 9ddfcd6a1bbc04ec399643a1ae2ddea546b69ef1 (diff) |
Make the source's send array static instead of dynamic
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 72ae1b1c..3791c7fd 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2269,25 +2269,19 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) usemask &= ~(1_u64 << idx); - if(old_sends != device->NumAuxSends) + auto clear_send = [](ALsource::SendData &send) -> void { - if(source->Send.size() > device->NumAuxSends) - { - auto clear_send = [](ALsource::SendData &send) -> void - { - if(send.Slot) - DecrementRef(send.Slot->ref); - send.Slot = nullptr; - }; - auto send_begin = source->Send.begin() + - static_cast<ptrdiff_t>(device->NumAuxSends); - std::for_each(send_begin, source->Send.end(), clear_send); - } - - source->Send.resize(device->NumAuxSends, - {nullptr, 1.0f, 1.0f, LOWPASSFREQREF, 1.0f, HIGHPASSFREQREF}); - source->Send.shrink_to_fit(); - } + if(send.Slot) + DecrementRef(send.Slot->ref); + send.Slot = nullptr; + send.Gain = 1.0f; + send.GainHF = 1.0f; + send.HFReference = LOWPASSFREQREF; + send.GainLF = 1.0f; + send.LFReference = HIGHPASSFREQREF; + }; + auto send_begin = source->Send.begin()+static_cast<ptrdiff_t>(device->NumAuxSends); + std::for_each(send_begin, source->Send.end(), clear_send); source->PropsClean.clear(std::memory_order_release); } |