diff options
author | Chris Robinson <[email protected]> | 2023-05-24 16:36:21 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-05-24 16:36:21 -0700 |
commit | 8db38cfb763acc231a3ddbcc9c49ff93d4531c16 (patch) | |
tree | c55b532a808fadccedb0e98c173a8648bb2ecbe9 /al/effects/pshifter.cpp | |
parent | f3e9d066df50a6e77e8c15ea97b195a4b069f254 (diff) |
Use a variant to hold EAX effect properties
Diffstat (limited to 'al/effects/pshifter.cpp')
-rw-r--r-- | al/effects/pshifter.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
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<int>(mEaxProps.mPitchShifter.lCoarseTune); - mAlProps.Pshifter.FineTune = static_cast<int>(mEaxProps.mPitchShifter.lFineTune); + auto &eaxprops = std::get<EAXPITCHSHIFTERPROPERTIES>(props); + mAlProps.Pshifter.CoarseTune = static_cast<int>(eaxprops.lCoarseTune); + mAlProps.Pshifter.FineTune = static_cast<int>(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<EAXPITCHSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXPITCHSHIFTER_NONE: break; - case EAXPITCHSHIFTER_ALLPARAMETERS: call.set_value<Exception>(props.mPitchShifter); break; - case EAXPITCHSHIFTER_COARSETUNE: call.set_value<Exception>(props.mPitchShifter.lCoarseTune); break; - case EAXPITCHSHIFTER_FINETUNE: call.set_value<Exception>(props.mPitchShifter.lFineTune); break; + case EAXPITCHSHIFTER_ALLPARAMETERS: call.set_value<Exception>(props); break; + case EAXPITCHSHIFTER_COARSETUNE: call.set_value<Exception>(props.lCoarseTune); break; + case EAXPITCHSHIFTER_FINETUNE: call.set_value<Exception>(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<EAXPITCHSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXPITCHSHIFTER_NONE: break; - case EAXPITCHSHIFTER_ALLPARAMETERS: defer<AllValidator>(call, props.mPitchShifter); break; - case EAXPITCHSHIFTER_COARSETUNE: defer<CoarseTuneValidator>(call, props.mPitchShifter.lCoarseTune); break; - case EAXPITCHSHIFTER_FINETUNE: defer<FineTuneValidator>(call, props.mPitchShifter.lFineTune); break; + case EAXPITCHSHIFTER_ALLPARAMETERS: defer<AllValidator>(call, props); break; + case EAXPITCHSHIFTER_COARSETUNE: defer<CoarseTuneValidator>(call, props.lCoarseTune); break; + case EAXPITCHSHIFTER_FINETUNE: defer<FineTuneValidator>(call, props.lFineTune); break; default: fail_unknown_property_id(); } } |