aboutsummaryrefslogtreecommitdiffstats
path: root/al/auxeffectslot.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-07-15 06:14:25 -0700
committerChris Robinson <[email protected]>2022-07-15 06:14:25 -0700
commit0f4679981b575cc76158126dec7d9bdda3ba1c29 (patch)
tree77e9176befdeb963e7dd791fc50df3db34f789bc /al/auxeffectslot.cpp
parent0b9fc03545f7418be89bb9a8901b342ce84a5f67 (diff)
Allocate EffectSlots in clusters
Diffstat (limited to 'al/auxeffectslot.cpp')
-rw-r--r--al/auxeffectslot.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 25814e83..aaf9ce4c 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -278,7 +278,7 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context)
auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask));
ASSUME(slidx < 64);
- ALeffectslot *slot{al::construct_at(sublist->EffectSlots + slidx)};
+ ALeffectslot *slot{al::construct_at(sublist->EffectSlots + slidx, context)};
aluInitEffectPanning(slot->mSlot, context);
/* Add 1 to avoid source ID 0. */
@@ -907,7 +907,7 @@ START_API_FUNC
END_API_FUNC
-ALeffectslot::ALeffectslot()
+ALeffectslot::ALeffectslot(ALCcontext *context)
{
EffectStateFactory *factory{getFactoryByType(EffectSlotType::None)};
if(!factory) throw std::runtime_error{"Failed to get null effect factory"};
@@ -915,7 +915,7 @@ ALeffectslot::ALeffectslot()
al::intrusive_ptr<EffectState> state{factory->create()};
Effect.State = state;
- mSlot = new EffectSlot{};
+ mSlot = context->getEffectSlot();
mSlot->mEffectState = state.release();
}
@@ -938,7 +938,7 @@ ALeffectslot::~ALeffectslot()
if(mSlot->mEffectState)
mSlot->mEffectState->release();
- delete mSlot;
+ mSlot->InUse = false;
}
ALenum ALeffectslot::initEffect(ALenum effectType, const EffectProps &effectProps,