diff options
Diffstat (limited to 'OpenAL32/alSource.cpp')
-rw-r--r-- | OpenAL32/alSource.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index dd418a58..cf466c32 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -582,10 +582,15 @@ inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) noexcept inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) noexcept { - --id; - if(UNLIKELY(id >= context->EffectSlotList.size())) + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= context->EffectSlotList.size())) + return nullptr; + EffectSlotSubList &sublist{context->EffectSlotList[lidx]}; + if(UNLIKELY(sublist.FreeMask & (1_u64 << slidx))) return nullptr; - return context->EffectSlotList[id].get(); + return sublist.EffectSlots + slidx; } |