From d7304c49a1d2cea2dae0ae38fdd9706dbcdb561f Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 23 Dec 2023 00:11:26 -0800 Subject: Pass the effect props directly to the eax committer functions Rather than the variant that was already checked for what it's holding. --- al/effects/modulator.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'al/effects/modulator.cpp') diff --git a/al/effects/modulator.cpp b/al/effects/modulator.cpp index 8bab41c9..d0a2df02 100644 --- a/al/effects/modulator.cpp +++ b/al/effects/modulator.cpp @@ -203,9 +203,9 @@ template<> throw Exception{message}; } -bool EaxModulatorCommitter::commit(const EaxEffectProps &props) +bool EaxModulatorCommitter::commit(const EAXRINGMODULATORPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; @@ -221,10 +221,9 @@ bool EaxModulatorCommitter::commit(const EaxEffectProps &props) return ModulatorWaveform::Sinusoid; }; - auto &eaxprops = std::get(props); - mAlProps.Modulator.Frequency = eaxprops.flFrequency; - mAlProps.Modulator.HighPassCutoff = eaxprops.flHighPassCutOff; - mAlProps.Modulator.Waveform = get_waveform(eaxprops.ulWaveform); + mAlProps.Modulator.Frequency = props.flFrequency; + mAlProps.Modulator.HighPassCutoff = props.flHighPassCutOff; + mAlProps.Modulator.Waveform = get_waveform(props.ulWaveform); return true; } @@ -242,9 +241,8 @@ void EaxModulatorCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -void EaxModulatorCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxModulatorCommitter::Get(const EaxCall &call, const EAXRINGMODULATORPROPERTIES &props) { - auto &props = std::get(props_); switch(call.get_property_id()) { case EAXRINGMODULATOR_NONE: break; @@ -256,10 +254,9 @@ void EaxModulatorCommitter::Get(const EaxCall &call, const EaxEffectProps &props } } -void EaxModulatorCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxModulatorCommitter::Set(const EaxCall &call, EAXRINGMODULATORPROPERTIES &props) { - auto &props = std::get(props_); - switch (call.get_property_id()) + switch(call.get_property_id()) { case EAXRINGMODULATOR_NONE: break; case EAXRINGMODULATOR_ALLPARAMETERS: defer(call, props); break; -- cgit v1.2.3