diff options
author | Chris Robinson <[email protected]> | 2022-07-15 06:14:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-07-15 06:14:25 -0700 |
commit | 0f4679981b575cc76158126dec7d9bdda3ba1c29 (patch) | |
tree | 77e9176befdeb963e7dd791fc50df3db34f789bc /al | |
parent | 0b9fc03545f7418be89bb9a8901b342ce84a5f67 (diff) |
Allocate EffectSlots in clusters
Diffstat (limited to 'al')
-rw-r--r-- | al/auxeffectslot.cpp | 8 | ||||
-rw-r--r-- | al/auxeffectslot.h | 2 |
2 files changed, 5 insertions, 5 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, diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h index 8b80a2d4..b8b41174 100644 --- a/al/auxeffectslot.h +++ b/al/auxeffectslot.h @@ -68,7 +68,7 @@ struct ALeffectslot { /* Self ID */ ALuint id{}; - ALeffectslot(); + ALeffectslot(ALCcontext *context); ALeffectslot(const ALeffectslot&) = delete; ALeffectslot& operator=(const ALeffectslot&) = delete; ~ALeffectslot(); |