From 8db38cfb763acc231a3ddbcc9c49ff93d4531c16 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 24 May 2023 16:36:21 -0700 Subject: Use a variant to hold EAX effect properties --- al/effects/pshifter.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'al/effects/pshifter.cpp') diff --git a/al/effects/pshifter.cpp b/al/effects/pshifter.cpp index 634eb186..10824016 100644 --- a/al/effects/pshifter.cpp +++ b/al/effects/pshifter.cpp @@ -141,15 +141,14 @@ template<> template<> bool PitchShifterCommitter::commit(const EaxEffectProps &props) { - if(props.mType == mEaxProps.mType - && mEaxProps.mPitchShifter.lCoarseTune == props.mPitchShifter.lCoarseTune - && mEaxProps.mPitchShifter.lFineTune == props.mPitchShifter.lFineTune) + if(props == mEaxProps) return false; mEaxProps = props; - mAlProps.Pshifter.CoarseTune = static_cast(mEaxProps.mPitchShifter.lCoarseTune); - mAlProps.Pshifter.FineTune = static_cast(mEaxProps.mPitchShifter.lFineTune); + auto &eaxprops = std::get(props); + mAlProps.Pshifter.CoarseTune = static_cast(eaxprops.lCoarseTune); + mAlProps.Pshifter.FineTune = static_cast(eaxprops.lFineTune); return true; } @@ -157,33 +156,34 @@ bool PitchShifterCommitter::commit(const EaxEffectProps &props) template<> void PitchShifterCommitter::SetDefaults(EaxEffectProps &props) { - props.mType = EaxEffectType::PitchShifter; - props.mPitchShifter.lCoarseTune = EAXPITCHSHIFTER_DEFAULTCOARSETUNE; - props.mPitchShifter.lFineTune = EAXPITCHSHIFTER_DEFAULTFINETUNE; + props = EAXPITCHSHIFTERPROPERTIES{EAXPITCHSHIFTER_DEFAULTCOARSETUNE, + EAXPITCHSHIFTER_DEFAULTFINETUNE}; } template<> -void PitchShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props) +void PitchShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) { + auto &props = std::get(props_); switch(call.get_property_id()) { case EAXPITCHSHIFTER_NONE: break; - case EAXPITCHSHIFTER_ALLPARAMETERS: call.set_value(props.mPitchShifter); break; - case EAXPITCHSHIFTER_COARSETUNE: call.set_value(props.mPitchShifter.lCoarseTune); break; - case EAXPITCHSHIFTER_FINETUNE: call.set_value(props.mPitchShifter.lFineTune); break; + case EAXPITCHSHIFTER_ALLPARAMETERS: call.set_value(props); break; + case EAXPITCHSHIFTER_COARSETUNE: call.set_value(props.lCoarseTune); break; + case EAXPITCHSHIFTER_FINETUNE: call.set_value(props.lFineTune); break; default: fail_unknown_property_id(); } } template<> -void PitchShifterCommitter::Set(const EaxCall &call, EaxEffectProps &props) +void PitchShifterCommitter::Set(const EaxCall &call, EaxEffectProps &props_) { + auto &props = std::get(props_); switch(call.get_property_id()) { case EAXPITCHSHIFTER_NONE: break; - case EAXPITCHSHIFTER_ALLPARAMETERS: defer(call, props.mPitchShifter); break; - case EAXPITCHSHIFTER_COARSETUNE: defer(call, props.mPitchShifter.lCoarseTune); break; - case EAXPITCHSHIFTER_FINETUNE: defer(call, props.mPitchShifter.lFineTune); break; + case EAXPITCHSHIFTER_ALLPARAMETERS: defer(call, props); break; + case EAXPITCHSHIFTER_COARSETUNE: defer(call, props.lCoarseTune); break; + case EAXPITCHSHIFTER_FINETUNE: defer(call, props.lFineTune); break; default: fail_unknown_property_id(); } } -- cgit v1.2.3