aboutsummaryrefslogtreecommitdiffstats
path: root/al/auxeffectslot.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-02-06 14:52:23 -0800
committerChris Robinson <[email protected]>2022-02-06 14:52:23 -0800
commit4df658fe3bf2b8bcdfbfb42d59a42c5efce291af (patch)
tree8b48a08a3416a4111e74b47410825c08b86e9b1a /al/auxeffectslot.cpp
parent784929f36dedbe3391eb1873101a30a801f69286 (diff)
Update the effectslot props with a function instead of a macro
Diffstat (limited to 'al/auxeffectslot.cpp')
-rw-r--r--al/auxeffectslot.cpp40
1 files changed, 13 insertions, 27 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index 4382553e..06e6b7a3 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -308,13 +308,14 @@ void FreeEffectSlot(ALCcontext *context, ALeffectslot *slot)
}
-#define DO_UPDATEPROPS() do { \
- if(!context->mDeferUpdates.load(std::memory_order_acquire) \
- && slot->mState == SlotState::Playing) \
- slot->updateProps(context.get()); \
- else \
- slot->mPropsDirty.set(std::memory_order_release); \
-} while(0)
+inline void UpdateProps(ALeffectslot *slot, ALCcontext *context)
+{
+ if(!context->mDeferUpdates.load(std::memory_order_acquire)
+ && slot->mState == SlotState::Playing)
+ slot->updateProps(context);
+ else
+ slot->mPropsDirty.set(std::memory_order_release);
+}
} // namespace
@@ -689,7 +690,7 @@ START_API_FUNC
SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid effect slot integer property 0x%04x",
param);
}
- DO_UPDATEPROPS();
+ UpdateProps(slot, context.get());
}
END_API_FUNC
@@ -750,7 +751,7 @@ START_API_FUNC
SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid effect slot float property 0x%04x",
param);
}
- DO_UPDATEPROPS();
+ UpdateProps(slot, context.get());
}
END_API_FUNC
@@ -1746,12 +1747,7 @@ void ALeffectslot::eax_set_effect_slot_effect(
return;
}
- {
- auto context = EaxAlContextWrapper{*eax_al_context_};
- auto slot = this;
-
- DO_UPDATEPROPS();
- }
+ UpdateProps(this, eax_al_context_);
#undef EAX_PREFIX
}
@@ -1766,12 +1762,7 @@ void ALeffectslot::eax_set_effect_slot_send_auto(
AuxSendAuto = is_send_auto;
if (is_changed)
- {
- auto context = EaxAlContextWrapper{*eax_al_context_};
- auto slot = this;
-
- DO_UPDATEPROPS();
- }
+ UpdateProps(this, eax_al_context_);
}
void ALeffectslot::eax_set_effect_slot_gain(
@@ -1792,12 +1783,7 @@ void ALeffectslot::eax_set_effect_slot_gain(
Gain = gain;
if (is_changed)
- {
- auto context = EaxAlContextWrapper{*eax_al_context_};
- auto slot = this;
-
- DO_UPDATEPROPS();
- }
+ UpdateProps(this, eax_al_context_);
#undef EAX_PREFIX
}