diff options
author | Chris Robinson <[email protected]> | 2020-03-29 03:10:35 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-03-29 03:10:35 -0700 |
commit | 5dfa24d5e271860cd58788790f9aefd742ab26b7 (patch) | |
tree | 80f01848a707e67ae8c985f727ebe96599231dca /alc | |
parent | a5b81672803951980b3b2aa7304e1fe69dd0325a (diff) |
Stop updating effects when one fails
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alc.cpp | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 880d2781..efc822ff 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2206,23 +2206,20 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) TRACE("Fixed device latency: %" PRId64 "ns\n", int64_t{device->FixedLatency.count()}); - /* Need to delay returning failure until replacement Send arrays have been - * allocated with the appropriate size. - */ + /* Need to delay returning failure until the Send arrays have been cleared. */ bool update_failed{false}; FPUCtl mixer_mode{}; for(ALCcontext *context : *device->mContexts.load()) { - if(context->mDefaultSlot) + if(context->mDefaultSlot && !update_failed) { ALeffectslot *slot{context->mDefaultSlot.get()}; aluInitEffectPanning(slot, device); EffectState *state{slot->Effect.State}; state->mOutTarget = device->Dry.Buffer; - if(!state->deviceUpdate(device)) - update_failed = true; - else + update_failed = !state->deviceUpdate(device); + if(!update_failed) UpdateEffectSlotProps(slot, context); } @@ -2232,22 +2229,21 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) std::fill_n(curarray->end(), curarray->size(), nullptr); for(auto &sublist : context->mEffectSlotList) { - uint64_t usemask = ~sublist.FreeMask; + if(update_failed) break; + uint64_t usemask{~sublist.FreeMask}; while(usemask) { - ALsizei idx = CTZ64(usemask); - ALeffectslot *slot = sublist.EffectSlots + idx; - + ALsizei idx{CTZ64(usemask)}; + ALeffectslot *slot{sublist.EffectSlots + idx}; usemask &= ~(1_u64 << idx); aluInitEffectPanning(slot, device); EffectState *state{slot->Effect.State}; state->mOutTarget = device->Dry.Buffer; - if(state->deviceUpdate(device) == AL_FALSE) - update_failed = true; - else - UpdateEffectSlotProps(slot, context); + update_failed = !state->deviceUpdate(device); + if(update_failed) break; + UpdateEffectSlotProps(slot, context); } } slotlock.unlock(); @@ -2255,12 +2251,11 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) std::unique_lock<std::mutex> srclock{context->mSourceLock}; for(auto &sublist : context->mSourceList) { - uint64_t usemask = ~sublist.FreeMask; + uint64_t usemask{~sublist.FreeMask}; while(usemask) { - ALsizei idx = CTZ64(usemask); - ALsource *source = sublist.Sources + idx; - + ALsizei idx{CTZ64(usemask)}; + ALsource *source{sublist.Sources + idx}; usemask &= ~(1_u64 << idx); auto clear_send = [](ALsource::SendData &send) -> void |