diff options
author | Chris Robinson <[email protected]> | 2023-08-11 02:10:26 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-08-11 02:10:26 -0700 |
commit | 09eff761b8c8a2da79b0083c86a304eb3643b396 (patch) | |
tree | 7408644f085ba7ccc6ca2f64d2f1959dbc4e1e08 /al/effect.cpp | |
parent | 9296af5566afea4ba4cb78b374ef3ee0bf9bc04b (diff) |
Add AL_EXT_debug functions to set/get object names
Diffstat (limited to 'al/effect.cpp')
-rw-r--r-- | al/effect.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/al/effect.cpp b/al/effect.cpp index 81cbb4c6..5c7f9627 100644 --- a/al/effect.cpp +++ b/al/effect.cpp @@ -207,6 +207,8 @@ ALeffect *AllocEffect(ALCdevice *device) void FreeEffect(ALCdevice *device, ALeffect *effect) { + device->mEffectNames.erase(effect->id); + const ALuint id{effect->id - 1}; const size_t lidx{id >> 6}; const ALuint slidx{id & 0x3f}; @@ -511,6 +513,19 @@ void InitEffect(ALeffect *effect) InitEffectParams(effect, AL_EFFECT_NULL); } +void ALeffect::SetName(ALCcontext* context, ALuint id, std::string_view name) +{ + ALCdevice *device{context->mALDevice.get()}; + std::lock_guard<std::mutex> _{device->EffectLock}; + + auto effect = LookupEffect(device, id); + if(!effect) UNLIKELY + return context->setError(AL_INVALID_NAME, "Invalid effect ID %u", id); + + device->mEffectNames.insert_or_assign(id, name); +} + + EffectSubList::~EffectSubList() { if(!Effects) |