aboutsummaryrefslogtreecommitdiffstats
path: root/al/auxeffectslot.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-08-11 02:10:26 -0700
committerChris Robinson <[email protected]>2023-08-11 02:10:26 -0700
commit09eff761b8c8a2da79b0083c86a304eb3643b396 (patch)
tree7408644f085ba7ccc6ca2f64d2f1959dbc4e1e08 /al/auxeffectslot.cpp
parent9296af5566afea4ba4cb78b374ef3ee0bf9bc04b (diff)
Add AL_EXT_debug functions to set/get object names
Diffstat (limited to 'al/auxeffectslot.cpp')
-rw-r--r--al/auxeffectslot.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 6f82db71..09db0736 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -286,6 +286,8 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context)
void FreeEffectSlot(ALCcontext *context, ALeffectslot *slot)
{
+ context->mEffectSlotNames.erase(slot->id);
+
const ALuint id{slot->id - 1};
const size_t lidx{id >> 6};
const ALuint slidx{id & 0x3f};
@@ -962,6 +964,17 @@ void ALeffectslot::updateProps(ALCcontext *context)
}
}
+void ALeffectslot::SetName(ALCcontext* context, ALuint id, std::string_view name)
+{
+ std::lock_guard<std::mutex> _{context->mEffectSlotLock};
+
+ auto slot = LookupEffectSlot(context, id);
+ if(!slot) UNLIKELY
+ return context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", id);
+
+ context->mEffectSlotNames.insert_or_assign(id, name);
+}
+
void UpdateAllEffectSlotProps(ALCcontext *context)
{
std::lock_guard<std::mutex> _{context->mEffectSlotLock};