diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 1 | ||||
-rw-r--r-- | OpenAL32/alAuxEffectSlot.cpp | 9 |
2 files changed, 6 insertions, 4 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index 539cee53..04f00758 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -78,6 +78,7 @@ struct ALeffectslot { struct { ALfloat Gain{1.0f}; ALboolean AuxSendAuto{AL_TRUE}; + ALeffectslot *Target{nullptr}; ALenum EffectType{AL_EFFECT_NULL}; ALeffectProps EffectProps{}; diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp index db22ca4c..ca279aee 100644 --- a/OpenAL32/alAuxEffectSlot.cpp +++ b/OpenAL32/alAuxEffectSlot.cpp @@ -71,10 +71,11 @@ void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *cont ALsizei newcount{curarray->count + count}; /* Insert the new effect slots into the head of the array, followed by the - * existing ones. + * existing ones. Allocate twice as much space for effect slots so the + * mixer has a place to sort them. */ auto newarray = static_cast<ALeffectslotArray*>(al_calloc(DEF_ALIGN, - FAM_SIZE(ALeffectslotArray, slot, newcount))); + FAM_SIZE(ALeffectslotArray, slot, newcount*2))); newarray->count = newcount; auto slotiter = std::transform(slotids, slotids+count, newarray->slot, [context](ALuint id) noexcept -> ALeffectslot* @@ -99,7 +100,7 @@ void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *cont { curarray = newarray; newarray = static_cast<ALeffectslotArray*>(al_calloc(DEF_ALIGN, - FAM_SIZE(ALeffectslotArray, slot, newcount))); + FAM_SIZE(ALeffectslotArray, slot, newcount*2))); newarray->count = newcount; std::copy_n(curarray->slot, newcount, newarray->slot); al_free(curarray); @@ -122,7 +123,7 @@ void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *c * any) of the effect slots to remove are in the array. */ auto newarray = static_cast<ALeffectslotArray*>(al_calloc(DEF_ALIGN, - FAM_SIZE(ALeffectslotArray, slot, curarray->count))); + FAM_SIZE(ALeffectslotArray, slot, curarray->count*2))); /* Copy each element in curarray to newarray whose ID is not in slotids. */ const ALuint *slotids_end{slotids + count}; |