aboutsummaryrefslogtreecommitdiffstats
path: root/al/auxeffectslot.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2020-09-05 21:04:41 -0700
committerChris Robinson <[email protected]>2020-09-05 21:04:41 -0700
commit13710b474e24cf57030d78818777b5301ba65782 (patch)
treeb55419a339ab971544812a0f5f4be38dff6b26c3 /al/auxeffectslot.cpp
parentc52bf8c401aaf78bbcfa99b33fdaf4838999d547 (diff)
Ensure effect slot properties are updated when playing
Diffstat (limited to 'al/auxeffectslot.cpp')
-rw-r--r--al/auxeffectslot.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index a4e945b4..e5ca89ce 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -244,7 +244,8 @@ void FreeEffectSlot(ALCcontext *context, ALeffectslot *slot)
#define DO_UPDATEPROPS() do { \
- if(!context->mDeferUpdates.load(std::memory_order_acquire)) \
+ if(!context->mDeferUpdates.load(std::memory_order_acquire) \
+ && slot->mState == SlotState::Playing) \
slot->updateProps(context.get()); \
else \
slot->PropsClean.clear(std::memory_order_release); \
@@ -382,6 +383,11 @@ START_API_FUNC
context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", slotid);
return;
}
+ if(slot->mState == SlotState::Playing)
+ return;
+
+ slot->PropsClean.test_and_set(std::memory_order_acq_rel);
+ slot->updateProps(context.get());
AddActiveEffectSlots(&slotid, 1, context.get());
slot->mState = SlotState::Playing;
@@ -409,7 +415,14 @@ START_API_FUNC
context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", id);
return false;
}
- slots.emplace_back(slot);
+
+ if(slot->mState != SlotState::Playing)
+ {
+ slot->PropsClean.test_and_set(std::memory_order_acq_rel);
+ slot->updateProps(context.get());
+
+ slots.emplace_back(slot);
+ }
return true;
};
auto slotids_end = slotids + n;