diff options
-rw-r--r-- | al/eax/effect.h | 92 | ||||
-rw-r--r-- | al/effects/autowah.cpp | 19 | ||||
-rw-r--r-- | al/effects/chorus.cpp | 35 | ||||
-rw-r--r-- | al/effects/compressor.cpp | 12 | ||||
-rw-r--r-- | al/effects/distortion.cpp | 21 | ||||
-rw-r--r-- | al/effects/echo.cpp | 21 | ||||
-rw-r--r-- | al/effects/equalizer.cpp | 31 | ||||
-rw-r--r-- | al/effects/fshifter.cpp | 17 | ||||
-rw-r--r-- | al/effects/modulator.cpp | 19 | ||||
-rw-r--r-- | al/effects/null.cpp | 8 | ||||
-rw-r--r-- | al/effects/pshifter.cpp | 15 | ||||
-rw-r--r-- | al/effects/reverb.cpp | 341 | ||||
-rw-r--r-- | al/effects/vmorpher.cpp | 23 |
13 files changed, 236 insertions, 418 deletions
diff --git a/al/eax/effect.h b/al/eax/effect.h index ce581990..a735fe6c 100644 --- a/al/eax/effect.h +++ b/al/eax/effect.h @@ -100,7 +100,6 @@ struct EaxReverbCommitter { bool commit(const EAX_REVERBPROPERTIES &props); bool commit(const EAX20LISTENERPROPERTIES &props); bool commit(const EAXREVERBPROPERTIES &props); - bool commit(const EaxEffectProps &props); static void SetDefaults(EAX_REVERBPROPERTIES &props); static void SetDefaults(EAX20LISTENERPROPERTIES &props); @@ -110,16 +109,13 @@ struct EaxReverbCommitter { static void Get(const EaxCall &call, const EAX_REVERBPROPERTIES &props); static void Get(const EaxCall &call, const EAX20LISTENERPROPERTIES &props); static void Get(const EaxCall &call, const EAXREVERBPROPERTIES &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); static void Set(const EaxCall &call, EAX_REVERBPROPERTIES &props); static void Set(const EaxCall &call, EAX20LISTENERPROPERTIES &props); static void Set(const EaxCall &call, EAXREVERBPROPERTIES &props); - static void Set(const EaxCall &call, EaxEffectProps &props); - static void translate(const EAX_REVERBPROPERTIES& src, EaxEffectProps& dst) noexcept; - static void translate(const EAX20LISTENERPROPERTIES& src, EaxEffectProps& dst) noexcept; - static void translate(const EAXREVERBPROPERTIES& src, EaxEffectProps& dst) noexcept; + static void translate(const EAX_REVERBPROPERTIES& src, EAXREVERBPROPERTIES& dst) noexcept; + static void translate(const EAX20LISTENERPROPERTIES& src, EAXREVERBPROPERTIES& dst) noexcept; }; template<typename T> @@ -149,110 +145,110 @@ struct EaxCommitter { struct EaxAutowahCommitter : public EaxCommitter<EaxAutowahCommitter> { using EaxCommitter<EaxAutowahCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXAUTOWAHPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXAUTOWAHPROPERTIES &props); + static void Set(const EaxCall &call, EAXAUTOWAHPROPERTIES &props); }; struct EaxChorusCommitter : public EaxCommitter<EaxChorusCommitter> { using EaxCommitter<EaxChorusCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXCHORUSPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXCHORUSPROPERTIES &props); + static void Set(const EaxCall &call, EAXCHORUSPROPERTIES &props); }; struct EaxCompressorCommitter : public EaxCommitter<EaxCompressorCommitter> { using EaxCommitter<EaxCompressorCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXAGCCOMPRESSORPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXAGCCOMPRESSORPROPERTIES &props); + static void Set(const EaxCall &call, EAXAGCCOMPRESSORPROPERTIES &props); }; struct EaxDistortionCommitter : public EaxCommitter<EaxDistortionCommitter> { using EaxCommitter<EaxDistortionCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXDISTORTIONPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXDISTORTIONPROPERTIES &props); + static void Set(const EaxCall &call, EAXDISTORTIONPROPERTIES &props); }; struct EaxEchoCommitter : public EaxCommitter<EaxEchoCommitter> { using EaxCommitter<EaxEchoCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXECHOPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXECHOPROPERTIES &props); + static void Set(const EaxCall &call, EAXECHOPROPERTIES &props); }; struct EaxEqualizerCommitter : public EaxCommitter<EaxEqualizerCommitter> { using EaxCommitter<EaxEqualizerCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXEQUALIZERPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXEQUALIZERPROPERTIES &props); + static void Set(const EaxCall &call, EAXEQUALIZERPROPERTIES &props); }; struct EaxFlangerCommitter : public EaxCommitter<EaxFlangerCommitter> { using EaxCommitter<EaxFlangerCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXFLANGERPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXFLANGERPROPERTIES &props); + static void Set(const EaxCall &call, EAXFLANGERPROPERTIES &props); }; struct EaxFrequencyShifterCommitter : public EaxCommitter<EaxFrequencyShifterCommitter> { using EaxCommitter<EaxFrequencyShifterCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXFREQUENCYSHIFTERPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXFREQUENCYSHIFTERPROPERTIES &props); + static void Set(const EaxCall &call, EAXFREQUENCYSHIFTERPROPERTIES &props); }; struct EaxModulatorCommitter : public EaxCommitter<EaxModulatorCommitter> { using EaxCommitter<EaxModulatorCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXRINGMODULATORPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXRINGMODULATORPROPERTIES &props); + static void Set(const EaxCall &call, EAXRINGMODULATORPROPERTIES &props); }; struct EaxPitchShifterCommitter : public EaxCommitter<EaxPitchShifterCommitter> { using EaxCommitter<EaxPitchShifterCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXPITCHSHIFTERPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXPITCHSHIFTERPROPERTIES &props); + static void Set(const EaxCall &call, EAXPITCHSHIFTERPROPERTIES &props); }; struct EaxVocalMorpherCommitter : public EaxCommitter<EaxVocalMorpherCommitter> { using EaxCommitter<EaxVocalMorpherCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const EAXVOCALMORPHERPROPERTIES &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const EAXVOCALMORPHERPROPERTIES &props); + static void Set(const EaxCall &call, EAXVOCALMORPHERPROPERTIES &props); }; struct EaxNullCommitter : public EaxCommitter<EaxNullCommitter> { using EaxCommitter<EaxNullCommitter>::EaxCommitter; - bool commit(const EaxEffectProps &props); + bool commit(const std::monostate &props); static void SetDefaults(EaxEffectProps &props); - static void Get(const EaxCall &call, const EaxEffectProps &props); - static void Set(const EaxCall &call, EaxEffectProps &props); + static void Get(const EaxCall &call, const std::monostate &props); + static void Set(const EaxCall &call, std::monostate &props); }; template<typename T> @@ -371,8 +367,8 @@ public: static void call_set(const EaxCall &call, EaxEffectProps &props) { - return std::visit([&](const auto &arg) - { return CommitterFor<decltype(arg)>::Set(call, props); }, + return std::visit([&](auto &arg) + { return CommitterFor<decltype(arg)>::Set(call, arg); }, props); } @@ -392,8 +388,8 @@ public: static void call_get(const EaxCall &call, const EaxEffectProps &props) { - return std::visit([&](const auto &arg) - { return CommitterFor<decltype(arg)>::Get(call, props); }, + return std::visit([&](auto &arg) + { return CommitterFor<decltype(arg)>::Get(call, arg); }, props); } @@ -412,8 +408,8 @@ public: bool call_commit(const EaxEffectProps &props) { - return std::visit([&](const auto &arg) - { return CommitterFor<decltype(arg)>{props_, al_effect_props_}.commit(props); }, + return std::visit([&](auto &arg) + { return CommitterFor<decltype(arg)>{props_, al_effect_props_}.commit(arg); }, props); } diff --git a/al/effects/autowah.cpp b/al/effects/autowah.cpp index c7ddbdb5..c0f845ac 100644 --- a/al/effects/autowah.cpp +++ b/al/effects/autowah.cpp @@ -189,18 +189,17 @@ template<> throw Exception{message}; } -bool EaxAutowahCommitter::commit(const EaxEffectProps &props) +bool EaxAutowahCommitter::commit(const EAXAUTOWAHPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXAUTOWAHPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; - auto &eaxprops = std::get<EAXAUTOWAHPROPERTIES>(props); - mAlProps.Autowah.AttackTime = eaxprops.flAttackTime; - mAlProps.Autowah.ReleaseTime = eaxprops.flReleaseTime; - mAlProps.Autowah.Resonance = level_mb_to_gain(static_cast<float>(eaxprops.lResonance)); - mAlProps.Autowah.PeakGain = level_mb_to_gain(static_cast<float>(eaxprops.lPeakLevel)); + mAlProps.Autowah.AttackTime = props.flAttackTime; + mAlProps.Autowah.ReleaseTime = props.flReleaseTime; + mAlProps.Autowah.Resonance = level_mb_to_gain(static_cast<float>(props.lResonance)); + mAlProps.Autowah.PeakGain = level_mb_to_gain(static_cast<float>(props.lPeakLevel)); return true; } @@ -219,9 +218,8 @@ void EaxAutowahCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -void EaxAutowahCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxAutowahCommitter::Get(const EaxCall &call, const EAXAUTOWAHPROPERTIES &props) { - auto &props = std::get<EAXAUTOWAHPROPERTIES>(props_); switch(call.get_property_id()) { case EAXAUTOWAH_NONE: break; @@ -234,9 +232,8 @@ void EaxAutowahCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) } } -void EaxAutowahCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxAutowahCommitter::Set(const EaxCall &call, EAXAUTOWAHPROPERTIES &props) { - auto &props = std::get<EAXAUTOWAHPROPERTIES>(props_); switch(call.get_property_id()) { case EAXAUTOWAH_NONE: break; diff --git a/al/effects/chorus.cpp b/al/effects/chorus.cpp index 61aab28f..aabeff97 100644 --- a/al/effects/chorus.cpp +++ b/al/effects/chorus.cpp @@ -518,9 +518,8 @@ public: } - static void Get(const EaxCall &call, const EaxEffectProps &props) + static void Get(const EaxCall &call, const typename Traits::Props &all) { - auto&& all = std::get<typename Traits::Props>(props); switch(call.get_property_id()) { case Traits::eax_none_param_id(): @@ -559,9 +558,8 @@ public: } } - static void Set(const EaxCall &call, EaxEffectProps &props) + static void Set(const EaxCall &call, typename Traits::Props &all) { - auto&& all = std::get<typename Traits::Props>(props); switch(call.get_property_id()) { case Traits::eax_none_param_id(): @@ -600,20 +598,19 @@ public: } } - static bool Commit(const EaxEffectProps &props, EaxEffectProps &props_, EffectProps &al_props_) + static bool Commit(const typename Traits::Props &props, EaxEffectProps &props_, EffectProps &al_props_) { - if(props == props_) + if(auto *cur = std::get_if<typename Traits::Props>(&props_); cur && *cur == props) return false; props_ = props; - auto&& dst = std::get<typename Traits::Props>(props); - al_props_.Chorus.Waveform = Traits::eax_waveform(dst.ulWaveform); - al_props_.Chorus.Phase = static_cast<int>(dst.lPhase); - al_props_.Chorus.Rate = dst.flRate; - al_props_.Chorus.Depth = dst.flDepth; - al_props_.Chorus.Feedback = dst.flFeedback; - al_props_.Chorus.Delay = dst.flDelay; + al_props_.Chorus.Waveform = Traits::eax_waveform(props.ulWaveform); + al_props_.Chorus.Phase = static_cast<int>(props.lPhase); + al_props_.Chorus.Rate = props.flRate; + al_props_.Chorus.Depth = props.flDepth; + al_props_.Chorus.Feedback = props.flFeedback; + al_props_.Chorus.Delay = props.flDelay; return true; } @@ -638,7 +635,7 @@ template<> throw Exception{message}; } -bool EaxChorusCommitter::commit(const EaxEffectProps &props) +bool EaxChorusCommitter::commit(const EAXCHORUSPROPERTIES &props) { using Committer = ChorusFlangerEffect<EaxChorusTraits>; return Committer::Commit(props, mEaxProps, mAlProps); @@ -650,13 +647,13 @@ void EaxChorusCommitter::SetDefaults(EaxEffectProps &props) Committer::SetDefaults(props); } -void EaxChorusCommitter::Get(const EaxCall &call, const EaxEffectProps &props) +void EaxChorusCommitter::Get(const EaxCall &call, const EAXCHORUSPROPERTIES &props) { using Committer = ChorusFlangerEffect<EaxChorusTraits>; Committer::Get(call, props); } -void EaxChorusCommitter::Set(const EaxCall &call, EaxEffectProps &props) +void EaxChorusCommitter::Set(const EaxCall &call, EAXCHORUSPROPERTIES &props) { using Committer = ChorusFlangerEffect<EaxChorusTraits>; Committer::Set(call, props); @@ -675,7 +672,7 @@ template<> throw Exception{message}; } -bool EaxFlangerCommitter::commit(const EaxEffectProps &props) +bool EaxFlangerCommitter::commit(const EAXFLANGERPROPERTIES &props) { using Committer = ChorusFlangerEffect<EaxFlangerTraits>; return Committer::Commit(props, mEaxProps, mAlProps); @@ -687,13 +684,13 @@ void EaxFlangerCommitter::SetDefaults(EaxEffectProps &props) Committer::SetDefaults(props); } -void EaxFlangerCommitter::Get(const EaxCall &call, const EaxEffectProps &props) +void EaxFlangerCommitter::Get(const EaxCall &call, const EAXFLANGERPROPERTIES &props) { using Committer = ChorusFlangerEffect<EaxFlangerTraits>; Committer::Get(call, props); } -void EaxFlangerCommitter::Set(const EaxCall &call, EaxEffectProps &props) +void EaxFlangerCommitter::Set(const EaxCall &call, EAXFLANGERPROPERTIES &props) { using Committer = ChorusFlangerEffect<EaxFlangerTraits>; Committer::Set(call, props); diff --git a/al/effects/compressor.cpp b/al/effects/compressor.cpp index 6dc96a20..9c4308f4 100644 --- a/al/effects/compressor.cpp +++ b/al/effects/compressor.cpp @@ -115,14 +115,14 @@ template<> throw Exception{message}; } -bool EaxCompressorCommitter::commit(const EaxEffectProps &props) +bool EaxCompressorCommitter::commit(const EAXAGCCOMPRESSORPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXAGCCOMPRESSORPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; - mAlProps.Compressor.OnOff = (std::get<EAXAGCCOMPRESSORPROPERTIES>(props).ulOnOff != 0); + mAlProps.Compressor.OnOff = props.ulOnOff != 0; return true; } @@ -131,9 +131,8 @@ void EaxCompressorCommitter::SetDefaults(EaxEffectProps &props) props = EAXAGCCOMPRESSORPROPERTIES{EAXAGCCOMPRESSOR_DEFAULTONOFF}; } -void EaxCompressorCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxCompressorCommitter::Get(const EaxCall &call, const EAXAGCCOMPRESSORPROPERTIES &props) { - auto &props = std::get<EAXAGCCOMPRESSORPROPERTIES>(props_); switch(call.get_property_id()) { case EAXAGCCOMPRESSOR_NONE: break; @@ -143,9 +142,8 @@ void EaxCompressorCommitter::Get(const EaxCall &call, const EaxEffectProps &prop } } -void EaxCompressorCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxCompressorCommitter::Set(const EaxCall &call, EAXAGCCOMPRESSORPROPERTIES &props) { - auto &props = std::get<EAXAGCCOMPRESSORPROPERTIES>(props_); switch(call.get_property_id()) { case EAXAGCCOMPRESSOR_NONE: break; diff --git a/al/effects/distortion.cpp b/al/effects/distortion.cpp index 9142398b..bec2af53 100644 --- a/al/effects/distortion.cpp +++ b/al/effects/distortion.cpp @@ -204,19 +204,18 @@ template<> throw Exception{message}; } -bool EaxDistortionCommitter::commit(const EaxEffectProps &props) +bool EaxDistortionCommitter::commit(const EAXDISTORTIONPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXDISTORTIONPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; - auto &eaxprops = std::get<EAXDISTORTIONPROPERTIES>(props); - mAlProps.Distortion.Edge = eaxprops.flEdge; - mAlProps.Distortion.Gain = level_mb_to_gain(static_cast<float>(eaxprops.lGain)); - mAlProps.Distortion.LowpassCutoff = eaxprops.flLowPassCutOff; - mAlProps.Distortion.EQCenter = eaxprops.flEQCenter; - mAlProps.Distortion.EQBandwidth = eaxprops.flEdge; + mAlProps.Distortion.Edge = props.flEdge; + mAlProps.Distortion.Gain = level_mb_to_gain(static_cast<float>(props.lGain)); + mAlProps.Distortion.LowpassCutoff = props.flLowPassCutOff; + mAlProps.Distortion.EQCenter = props.flEQCenter; + mAlProps.Distortion.EQBandwidth = props.flEdge; return true; } @@ -236,9 +235,8 @@ void EaxDistortionCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -void EaxDistortionCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxDistortionCommitter::Get(const EaxCall &call, const EAXDISTORTIONPROPERTIES &props) { - auto &props = std::get<EAXDISTORTIONPROPERTIES>(props_); switch(call.get_property_id()) { case EAXDISTORTION_NONE: break; @@ -252,9 +250,8 @@ void EaxDistortionCommitter::Get(const EaxCall &call, const EaxEffectProps &prop } } -void EaxDistortionCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxDistortionCommitter::Set(const EaxCall &call, EAXDISTORTIONPROPERTIES &props) { - auto &props = std::get<EAXDISTORTIONPROPERTIES>(props_); switch(call.get_property_id()) { case EAXDISTORTION_NONE: break; diff --git a/al/effects/echo.cpp b/al/effects/echo.cpp index bfec6885..90f109da 100644 --- a/al/effects/echo.cpp +++ b/al/effects/echo.cpp @@ -201,19 +201,18 @@ template<> throw Exception{message}; } -bool EaxEchoCommitter::commit(const EaxEffectProps &props) +bool EaxEchoCommitter::commit(const EAXECHOPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXECHOPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; - auto &eaxprops = std::get<EAXECHOPROPERTIES>(props); - mAlProps.Echo.Delay = eaxprops.flDelay; - mAlProps.Echo.LRDelay = eaxprops.flLRDelay; - mAlProps.Echo.Damping = eaxprops.flDamping; - mAlProps.Echo.Feedback = eaxprops.flFeedback; - mAlProps.Echo.Spread = eaxprops.flSpread; + mAlProps.Echo.Delay = props.flDelay; + mAlProps.Echo.LRDelay = props.flLRDelay; + mAlProps.Echo.Damping = props.flDamping; + mAlProps.Echo.Feedback = props.flFeedback; + mAlProps.Echo.Spread = props.flSpread; return true; } @@ -233,9 +232,8 @@ void EaxEchoCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -void EaxEchoCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxEchoCommitter::Get(const EaxCall &call, const EAXECHOPROPERTIES &props) { - auto &props = std::get<EAXECHOPROPERTIES>(props_); switch(call.get_property_id()) { case EAXECHO_NONE: break; @@ -249,9 +247,8 @@ void EaxEchoCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) } } -void EaxEchoCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxEchoCommitter::Set(const EaxCall &call, EAXECHOPROPERTIES &props) { - auto &props = std::get<EAXECHOPROPERTIES>(props_); switch(call.get_property_id()) { case EAXECHO_NONE: break; diff --git a/al/effects/equalizer.cpp b/al/effects/equalizer.cpp index b16be2a5..921d1090 100644 --- a/al/effects/equalizer.cpp +++ b/al/effects/equalizer.cpp @@ -319,24 +319,23 @@ template<> throw Exception{message}; } -bool EaxEqualizerCommitter::commit(const EaxEffectProps &props) +bool EaxEqualizerCommitter::commit(const EAXEQUALIZERPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXEQUALIZERPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; - auto &eaxprops = std::get<EAXEQUALIZERPROPERTIES>(props); - mAlProps.Equalizer.LowGain = level_mb_to_gain(static_cast<float>(eaxprops.lLowGain)); - mAlProps.Equalizer.LowCutoff = eaxprops.flLowCutOff; - mAlProps.Equalizer.Mid1Gain = level_mb_to_gain(static_cast<float>(eaxprops.lMid1Gain)); - mAlProps.Equalizer.Mid1Center = eaxprops.flMid1Center; - mAlProps.Equalizer.Mid1Width = eaxprops.flMid1Width; - mAlProps.Equalizer.Mid2Gain = level_mb_to_gain(static_cast<float>(eaxprops.lMid2Gain)); - mAlProps.Equalizer.Mid2Center = eaxprops.flMid2Center; - mAlProps.Equalizer.Mid2Width = eaxprops.flMid2Width; - mAlProps.Equalizer.HighGain = level_mb_to_gain(static_cast<float>(eaxprops.lHighGain)); - mAlProps.Equalizer.HighCutoff = eaxprops.flHighCutOff; + mAlProps.Equalizer.LowGain = level_mb_to_gain(static_cast<float>(props.lLowGain)); + mAlProps.Equalizer.LowCutoff = props.flLowCutOff; + mAlProps.Equalizer.Mid1Gain = level_mb_to_gain(static_cast<float>(props.lMid1Gain)); + mAlProps.Equalizer.Mid1Center = props.flMid1Center; + mAlProps.Equalizer.Mid1Width = props.flMid1Width; + mAlProps.Equalizer.Mid2Gain = level_mb_to_gain(static_cast<float>(props.lMid2Gain)); + mAlProps.Equalizer.Mid2Center = props.flMid2Center; + mAlProps.Equalizer.Mid2Width = props.flMid2Width; + mAlProps.Equalizer.HighGain = level_mb_to_gain(static_cast<float>(props.lHighGain)); + mAlProps.Equalizer.HighCutoff = props.flHighCutOff; return true; } @@ -361,9 +360,8 @@ void EaxEqualizerCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -void EaxEqualizerCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxEqualizerCommitter::Get(const EaxCall &call, const EAXEQUALIZERPROPERTIES &props) { - auto &props = std::get<EAXEQUALIZERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXEQUALIZER_NONE: break; @@ -382,9 +380,8 @@ void EaxEqualizerCommitter::Get(const EaxCall &call, const EaxEffectProps &props } } -void EaxEqualizerCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxEqualizerCommitter::Set(const EaxCall &call, EAXEQUALIZERPROPERTIES &props) { - auto &props = std::get<EAXEQUALIZERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXEQUALIZER_NONE: break; diff --git a/al/effects/fshifter.cpp b/al/effects/fshifter.cpp index 45253563..a6b3c86c 100644 --- a/al/effects/fshifter.cpp +++ b/al/effects/fshifter.cpp @@ -197,9 +197,9 @@ template<> throw Exception{message}; } -bool EaxFrequencyShifterCommitter::commit(const EaxEffectProps &props) +bool EaxFrequencyShifterCommitter::commit(const EAXFREQUENCYSHIFTERPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXFREQUENCYSHIFTERPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; @@ -213,10 +213,9 @@ bool EaxFrequencyShifterCommitter::commit(const EaxEffectProps &props) return FShifterDirection::Off; }; - auto &eaxprops = std::get<EAXFREQUENCYSHIFTERPROPERTIES>(props); - mAlProps.Fshifter.Frequency = eaxprops.flFrequency; - mAlProps.Fshifter.LeftDirection = get_direction(eaxprops.ulLeftDirection); - mAlProps.Fshifter.RightDirection = get_direction(eaxprops.ulRightDirection); + mAlProps.Fshifter.Frequency = props.flFrequency; + mAlProps.Fshifter.LeftDirection = get_direction(props.ulLeftDirection); + mAlProps.Fshifter.RightDirection = get_direction(props.ulRightDirection); return true; } @@ -234,9 +233,8 @@ void EaxFrequencyShifterCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -void EaxFrequencyShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxFrequencyShifterCommitter::Get(const EaxCall &call, const EAXFREQUENCYSHIFTERPROPERTIES &props) { - auto &props = std::get<EAXFREQUENCYSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXFREQUENCYSHIFTER_NONE: break; @@ -248,9 +246,8 @@ void EaxFrequencyShifterCommitter::Get(const EaxCall &call, const EaxEffectProps } } -void EaxFrequencyShifterCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxFrequencyShifterCommitter::Set(const EaxCall &call, EAXFREQUENCYSHIFTERPROPERTIES &props) { - auto &props = std::get<EAXFREQUENCYSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXFREQUENCYSHIFTER_NONE: break; 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<EAXRINGMODULATORPROPERTIES>(&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<EAXRINGMODULATORPROPERTIES>(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<EAXRINGMODULATORPROPERTIES>(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<EAXRINGMODULATORPROPERTIES>(props_); - switch (call.get_property_id()) + switch(call.get_property_id()) { case EAXRINGMODULATOR_NONE: break; case EAXRINGMODULATOR_ALLPARAMETERS: defer<AllValidator>(call, props); break; diff --git a/al/effects/null.cpp b/al/effects/null.cpp index 5d8e717e..4b68a28f 100644 --- a/al/effects/null.cpp +++ b/al/effects/null.cpp @@ -117,9 +117,9 @@ template<> throw Exception{message}; } -bool EaxNullCommitter::commit(const EaxEffectProps &props) +bool EaxNullCommitter::commit(const std::monostate &props) { - const bool ret{props != mEaxProps}; + const bool ret{std::holds_alternative<std::monostate>(mEaxProps)}; mEaxProps = props; return ret; } @@ -129,13 +129,13 @@ void EaxNullCommitter::SetDefaults(EaxEffectProps &props) props.emplace<std::monostate>(); } -void EaxNullCommitter::Get(const EaxCall &call, const EaxEffectProps&) +void EaxNullCommitter::Get(const EaxCall &call, const std::monostate&) { if(call.get_property_id() != 0) fail_unknown_property_id(); } -void EaxNullCommitter::Set(const EaxCall &call, EaxEffectProps&) +void EaxNullCommitter::Set(const EaxCall &call, std::monostate&) { if(call.get_property_id() != 0) fail_unknown_property_id(); diff --git a/al/effects/pshifter.cpp b/al/effects/pshifter.cpp index 93b4fefe..f29a3593 100644 --- a/al/effects/pshifter.cpp +++ b/al/effects/pshifter.cpp @@ -138,16 +138,15 @@ template<> throw Exception{message}; } -bool EaxPitchShifterCommitter::commit(const EaxEffectProps &props) +bool EaxPitchShifterCommitter::commit(const EAXPITCHSHIFTERPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXPITCHSHIFTERPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; - auto &eaxprops = std::get<EAXPITCHSHIFTERPROPERTIES>(props); - mAlProps.Pshifter.CoarseTune = static_cast<int>(eaxprops.lCoarseTune); - mAlProps.Pshifter.FineTune = static_cast<int>(eaxprops.lFineTune); + mAlProps.Pshifter.CoarseTune = static_cast<int>(props.lCoarseTune); + mAlProps.Pshifter.FineTune = static_cast<int>(props.lFineTune); return true; } @@ -158,9 +157,8 @@ void EaxPitchShifterCommitter::SetDefaults(EaxEffectProps &props) EAXPITCHSHIFTER_DEFAULTFINETUNE}; } -void EaxPitchShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxPitchShifterCommitter::Get(const EaxCall &call, const EAXPITCHSHIFTERPROPERTIES &props) { - auto &props = std::get<EAXPITCHSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXPITCHSHIFTER_NONE: break; @@ -171,9 +169,8 @@ void EaxPitchShifterCommitter::Get(const EaxCall &call, const EaxEffectProps &pr } } -void EaxPitchShifterCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxPitchShifterCommitter::Set(const EaxCall &call, EAXPITCHSHIFTERPROPERTIES &props) { - auto &props = std::get<EAXPITCHSHIFTERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXPITCHSHIFTER_NONE: break; diff --git a/al/effects/reverb.cpp b/al/effects/reverb.cpp index b037443f..7f549f04 100644 --- a/al/effects/reverb.cpp +++ b/al/effects/reverb.cpp @@ -1086,98 +1086,85 @@ struct EaxReverbCommitter::Exception : public EaxReverbEffectException throw Exception{message}; } -void EaxReverbCommitter::translate(const EAX_REVERBPROPERTIES& src, EaxEffectProps& dst) noexcept +void EaxReverbCommitter::translate(const EAX_REVERBPROPERTIES& src, EAXREVERBPROPERTIES& dst) noexcept { assert(src.environment <= EAX1REVERB_MAXENVIRONMENT); - auto&& eaxprops = dst.emplace<EAXREVERBPROPERTIES>(EAXREVERB_PRESETS[src.environment]); - eaxprops.flDecayTime = src.fDecayTime_sec; - eaxprops.flDecayHFRatio = src.fDamping; - eaxprops.lReverb = mini(static_cast<int>(gain_to_level_mb(src.fVolume)), 0); + dst = EAXREVERB_PRESETS[src.environment]; + dst.flDecayTime = src.fDecayTime_sec; + dst.flDecayHFRatio = src.fDamping; + dst.lReverb = mini(static_cast<int>(gain_to_level_mb(src.fVolume)), 0); } -void EaxReverbCommitter::translate(const EAX20LISTENERPROPERTIES& src, EaxEffectProps& dst) noexcept +void EaxReverbCommitter::translate(const EAX20LISTENERPROPERTIES& src, EAXREVERBPROPERTIES& dst) noexcept { assert(src.dwEnvironment <= EAX1REVERB_MAXENVIRONMENT); - auto&& eaxprops = dst.emplace<EAXREVERBPROPERTIES>(EAXREVERB_PRESETS[src.dwEnvironment]); - eaxprops.ulEnvironment = src.dwEnvironment; - eaxprops.flEnvironmentSize = src.flEnvironmentSize; - eaxprops.flEnvironmentDiffusion = src.flEnvironmentDiffusion; - eaxprops.lRoom = src.lRoom; - eaxprops.lRoomHF = src.lRoomHF; - eaxprops.flDecayTime = src.flDecayTime; - eaxprops.flDecayHFRatio = src.flDecayHFRatio; - eaxprops.lReflections = src.lReflections; - eaxprops.flReflectionsDelay = src.flReflectionsDelay; - eaxprops.lReverb = src.lReverb; - eaxprops.flReverbDelay = src.flReverbDelay; - eaxprops.flAirAbsorptionHF = src.flAirAbsorptionHF; - eaxprops.flRoomRolloffFactor = src.flRoomRolloffFactor; - eaxprops.ulFlags = src.dwFlags; -} - -void EaxReverbCommitter::translate(const EAXREVERBPROPERTIES& src, EaxEffectProps& dst) noexcept -{ - dst = src; + dst = EAXREVERB_PRESETS[src.dwEnvironment]; + dst.ulEnvironment = src.dwEnvironment; + dst.flEnvironmentSize = src.flEnvironmentSize; + dst.flEnvironmentDiffusion = src.flEnvironmentDiffusion; + dst.lRoom = src.lRoom; + dst.lRoomHF = src.lRoomHF; + dst.flDecayTime = src.flDecayTime; + dst.flDecayHFRatio = src.flDecayHFRatio; + dst.lReflections = src.lReflections; + dst.flReflectionsDelay = src.flReflectionsDelay; + dst.lReverb = src.lReverb; + dst.flReverbDelay = src.flReverbDelay; + dst.flAirAbsorptionHF = src.flAirAbsorptionHF; + dst.flRoomRolloffFactor = src.flRoomRolloffFactor; + dst.ulFlags = src.dwFlags; } bool EaxReverbCommitter::commit(const EAX_REVERBPROPERTIES &props) { - EaxEffectProps dst{}; + EAXREVERBPROPERTIES dst{}; translate(props, dst); return commit(dst); } bool EaxReverbCommitter::commit(const EAX20LISTENERPROPERTIES &props) { - EaxEffectProps dst{}; + EAXREVERBPROPERTIES dst{}; translate(props, dst); return commit(dst); } bool EaxReverbCommitter::commit(const EAXREVERBPROPERTIES &props) { - EaxEffectProps dst{}; - translate(props, dst); - return commit(dst); -} - -bool EaxReverbCommitter::commit(const EaxEffectProps &props) -{ - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXREVERBPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; - auto &eaxprops = std::get<EAXREVERBPROPERTIES>(props); - const auto size = eaxprops.flEnvironmentSize; - const auto density = (size * size * size) / 16.0F; + const auto size = props.flEnvironmentSize; + const auto density = (size * size * size) / 16.0f; mAlProps.Reverb.Density = std::min(density, AL_EAXREVERB_MAX_DENSITY); - mAlProps.Reverb.Diffusion = eaxprops.flEnvironmentDiffusion; - mAlProps.Reverb.Gain = level_mb_to_gain(static_cast<float>(eaxprops.lRoom)); - mAlProps.Reverb.GainHF = level_mb_to_gain(static_cast<float>(eaxprops.lRoomHF)); - mAlProps.Reverb.GainLF = level_mb_to_gain(static_cast<float>(eaxprops.lRoomLF)); - mAlProps.Reverb.DecayTime = eaxprops.flDecayTime; - mAlProps.Reverb.DecayHFRatio = eaxprops.flDecayHFRatio; - mAlProps.Reverb.DecayLFRatio = eaxprops.flDecayLFRatio; - mAlProps.Reverb.ReflectionsGain = level_mb_to_gain(static_cast<float>(eaxprops.lReflections)); - mAlProps.Reverb.ReflectionsDelay = eaxprops.flReflectionsDelay; - mAlProps.Reverb.ReflectionsPan[0] = eaxprops.vReflectionsPan.x; - mAlProps.Reverb.ReflectionsPan[1] = eaxprops.vReflectionsPan.y; - mAlProps.Reverb.ReflectionsPan[2] = eaxprops.vReflectionsPan.z; - mAlProps.Reverb.LateReverbGain = level_mb_to_gain(static_cast<float>(eaxprops.lReverb)); - mAlProps.Reverb.LateReverbDelay = eaxprops.flReverbDelay; - mAlProps.Reverb.LateReverbPan[0] = eaxprops.vReverbPan.x; - mAlProps.Reverb.LateReverbPan[1] = eaxprops.vReverbPan.y; - mAlProps.Reverb.LateReverbPan[2] = eaxprops.vReverbPan.z; - mAlProps.Reverb.EchoTime = eaxprops.flEchoTime; - mAlProps.Reverb.EchoDepth = eaxprops.flEchoDepth; - mAlProps.Reverb.ModulationTime = eaxprops.flModulationTime; - mAlProps.Reverb.ModulationDepth = eaxprops.flModulationDepth; - mAlProps.Reverb.AirAbsorptionGainHF = level_mb_to_gain(eaxprops.flAirAbsorptionHF); - mAlProps.Reverb.HFReference = eaxprops.flHFReference; - mAlProps.Reverb.LFReference = eaxprops.flLFReference; - mAlProps.Reverb.RoomRolloffFactor = eaxprops.flRoomRolloffFactor; - mAlProps.Reverb.DecayHFLimit = ((eaxprops.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0); + mAlProps.Reverb.Diffusion = props.flEnvironmentDiffusion; + mAlProps.Reverb.Gain = level_mb_to_gain(static_cast<float>(props.lRoom)); + mAlProps.Reverb.GainHF = level_mb_to_gain(static_cast<float>(props.lRoomHF)); + mAlProps.Reverb.GainLF = level_mb_to_gain(static_cast<float>(props.lRoomLF)); + mAlProps.Reverb.DecayTime = props.flDecayTime; + mAlProps.Reverb.DecayHFRatio = props.flDecayHFRatio; + mAlProps.Reverb.DecayLFRatio = props.flDecayLFRatio; + mAlProps.Reverb.ReflectionsGain = level_mb_to_gain(static_cast<float>(props.lReflections)); + mAlProps.Reverb.ReflectionsDelay = props.flReflectionsDelay; + mAlProps.Reverb.ReflectionsPan[0] = props.vReflectionsPan.x; + mAlProps.Reverb.ReflectionsPan[1] = props.vReflectionsPan.y; + mAlProps.Reverb.ReflectionsPan[2] = props.vReflectionsPan.z; + mAlProps.Reverb.LateReverbGain = level_mb_to_gain(static_cast<float>(props.lReverb)); + mAlProps.Reverb.LateReverbDelay = props.flReverbDelay; + mAlProps.Reverb.LateReverbPan[0] = props.vReverbPan.x; + mAlProps.Reverb.LateReverbPan[1] = props.vReverbPan.y; + mAlProps.Reverb.LateReverbPan[2] = props.vReverbPan.z; + mAlProps.Reverb.EchoTime = props.flEchoTime; + mAlProps.Reverb.EchoDepth = props.flEchoDepth; + mAlProps.Reverb.ModulationTime = props.flModulationTime; + mAlProps.Reverb.ModulationDepth = props.flModulationDepth; + mAlProps.Reverb.AirAbsorptionGainHF = level_mb_to_gain(props.flAirAbsorptionHF); + mAlProps.Reverb.HFReference = props.flHFReference; + mAlProps.Reverb.LFReference = props.flLFReference; + mAlProps.Reverb.RoomRolloffFactor = props.flRoomRolloffFactor; + mAlProps.Reverb.DecayHFLimit = ((props.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0); return true; } @@ -1274,11 +1261,6 @@ void EaxReverbCommitter::Get(const EaxCall &call, const EAXREVERBPROPERTIES &pro } } -void EaxReverbCommitter::Get(const EaxCall &call, const EaxEffectProps &props) -{ - Get(call, std::get<EAXREVERBPROPERTIES>(props)); -} - void EaxReverbCommitter::Set(const EaxCall &call, EAX_REVERBPROPERTIES &props) { @@ -1297,71 +1279,23 @@ void EaxReverbCommitter::Set(const EaxCall &call, EAX20LISTENERPROPERTIES &props { switch(call.get_property_id()) { - case DSPROPERTY_EAX20LISTENER_NONE: - break; - - case DSPROPERTY_EAX20LISTENER_ALLPARAMETERS: - defer<AllValidator2>(call, props); - break; - - case DSPROPERTY_EAX20LISTENER_ROOM: - defer<RoomValidator>(call, props.lRoom); - break; - - case DSPROPERTY_EAX20LISTENER_ROOMHF: - defer<RoomHFValidator>(call, props.lRoomHF); - break; - - case DSPROPERTY_EAX20LISTENER_ROOMROLLOFFFACTOR: - defer<RoomRolloffFactorValidator>(call, props.flRoomRolloffFactor); - break; - - case DSPROPERTY_EAX20LISTENER_DECAYTIME: - defer<DecayTimeValidator>(call, props.flDecayTime); - break; - - case DSPROPERTY_EAX20LISTENER_DECAYHFRATIO: - defer<DecayHFRatioValidator>(call, props.flDecayHFRatio); - break; - - case DSPROPERTY_EAX20LISTENER_REFLECTIONS: - defer<ReflectionsValidator>(call, props.lReflections); - break; - - case DSPROPERTY_EAX20LISTENER_REFLECTIONSDELAY: - defer<ReflectionsDelayValidator>(call, props.flReverbDelay); - break; - - case DSPROPERTY_EAX20LISTENER_REVERB: - defer<ReverbValidator>(call, props.lReverb); - break; - - case DSPROPERTY_EAX20LISTENER_REVERBDELAY: - defer<ReverbDelayValidator>(call, props.flReverbDelay); - break; - - case DSPROPERTY_EAX20LISTENER_ENVIRONMENT: - defer<EnvironmentValidator1, EnvironmentDeferrer2>(call, props, props.dwEnvironment); - break; - - case DSPROPERTY_EAX20LISTENER_ENVIRONMENTSIZE: - defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer2>(call, props, props.flEnvironmentSize); - break; - - case DSPROPERTY_EAX20LISTENER_ENVIRONMENTDIFFUSION: - defer<EnvironmentDiffusionValidator>(call, props.flEnvironmentDiffusion); - break; - - case DSPROPERTY_EAX20LISTENER_AIRABSORPTIONHF: - defer<AirAbsorptionHFValidator>(call, props.flAirAbsorptionHF); - break; - - case DSPROPERTY_EAX20LISTENER_FLAGS: - defer<FlagsValidator2>(call, props.dwFlags); - break; - - default: - fail_unknown_property_id(); + case DSPROPERTY_EAX20LISTENER_NONE: break; + case DSPROPERTY_EAX20LISTENER_ALLPARAMETERS: defer<AllValidator2>(call, props); break; + case DSPROPERTY_EAX20LISTENER_ROOM: defer<RoomValidator>(call, props.lRoom); break; + case DSPROPERTY_EAX20LISTENER_ROOMHF: defer<RoomHFValidator>(call, props.lRoomHF); break; + case DSPROPERTY_EAX20LISTENER_ROOMROLLOFFFACTOR: defer<RoomRolloffFactorValidator>(call, props.flRoomRolloffFactor); break; + case DSPROPERTY_EAX20LISTENER_DECAYTIME: defer<DecayTimeValidator>(call, props.flDecayTime); break; + case DSPROPERTY_EAX20LISTENER_DECAYHFRATIO: defer<DecayHFRatioValidator>(call, props.flDecayHFRatio); break; + case DSPROPERTY_EAX20LISTENER_REFLECTIONS: defer<ReflectionsValidator>(call, props.lReflections); break; + case DSPROPERTY_EAX20LISTENER_REFLECTIONSDELAY: defer<ReflectionsDelayValidator>(call, props.flReverbDelay); break; + case DSPROPERTY_EAX20LISTENER_REVERB: defer<ReverbValidator>(call, props.lReverb); break; + case DSPROPERTY_EAX20LISTENER_REVERBDELAY: defer<ReverbDelayValidator>(call, props.flReverbDelay); break; + case DSPROPERTY_EAX20LISTENER_ENVIRONMENT: defer<EnvironmentValidator1, EnvironmentDeferrer2>(call, props, props.dwEnvironment); break; + case DSPROPERTY_EAX20LISTENER_ENVIRONMENTSIZE: defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer2>(call, props, props.flEnvironmentSize); break; + case DSPROPERTY_EAX20LISTENER_ENVIRONMENTDIFFUSION: defer<EnvironmentDiffusionValidator>(call, props.flEnvironmentDiffusion); break; + case DSPROPERTY_EAX20LISTENER_AIRABSORPTIONHF: defer<AirAbsorptionHFValidator>(call, props.flAirAbsorptionHF); break; + case DSPROPERTY_EAX20LISTENER_FLAGS: defer<FlagsValidator2>(call, props.dwFlags); break; + default: fail_unknown_property_id(); } } @@ -1369,117 +1303,34 @@ void EaxReverbCommitter::Set(const EaxCall &call, EAXREVERBPROPERTIES &props) { switch(call.get_property_id()) { - case EAXREVERB_NONE: - break; - - case EAXREVERB_ALLPARAMETERS: - defer<AllValidator3>(call, props); - break; - - case EAXREVERB_ENVIRONMENT: - defer<EnvironmentValidator3, EnvironmentDeferrer3>(call, props, props.ulEnvironment); - break; - - case EAXREVERB_ENVIRONMENTSIZE: - defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer3>(call, props, props.flEnvironmentSize); - break; - - case EAXREVERB_ENVIRONMENTDIFFUSION: - defer3<EnvironmentDiffusionValidator>(call, props, props.flEnvironmentDiffusion); - break; - - case EAXREVERB_ROOM: - defer3<RoomValidator>(call, props, props.lRoom); - break; - - case EAXREVERB_ROOMHF: - defer3<RoomHFValidator>(call, props, props.lRoomHF); - break; - - case EAXREVERB_ROOMLF: - defer3<RoomLFValidator>(call, props, props.lRoomLF); - break; - - case EAXREVERB_DECAYTIME: - defer3<DecayTimeValidator>(call, props, props.flDecayTime); - break; - - case EAXREVERB_DECAYHFRATIO: - defer3<DecayHFRatioValidator>(call, props, props.flDecayHFRatio); - break; - - case EAXREVERB_DECAYLFRATIO: - defer3<DecayLFRatioValidator>(call, props, props.flDecayLFRatio); - break; - - case EAXREVERB_REFLECTIONS: - defer3<ReflectionsValidator>(call, props, props.lReflections); - break; - - case EAXREVERB_REFLECTIONSDELAY: - defer3<ReflectionsDelayValidator>(call, props, props.flReflectionsDelay); - break; - - case EAXREVERB_REFLECTIONSPAN: - defer3<VectorValidator>(call, props, props.vReflectionsPan); - break; - - case EAXREVERB_REVERB: - defer3<ReverbValidator>(call, props, props.lReverb); - break; - - case EAXREVERB_REVERBDELAY: - defer3<ReverbDelayValidator>(call, props, props.flReverbDelay); - break; - - case EAXREVERB_REVERBPAN: - defer3<VectorValidator>(call, props, props.vReverbPan); - break; - - case EAXREVERB_ECHOTIME: - defer3<EchoTimeValidator>(call, props, props.flEchoTime); - break; - - case EAXREVERB_ECHODEPTH: - defer3<EchoDepthValidator>(call, props, props.flEchoDepth); - break; - - case EAXREVERB_MODULATIONTIME: - defer3<ModulationTimeValidator>(call, props, props.flModulationTime); - break; - - case EAXREVERB_MODULATIONDEPTH: - defer3<ModulationDepthValidator>(call, props, props.flModulationDepth); - break; - - case EAXREVERB_AIRABSORPTIONHF: - defer3<AirAbsorptionHFValidator>(call, props, props.flAirAbsorptionHF); - break; - - case EAXREVERB_HFREFERENCE: - defer3<HFReferenceValidator>(call, props, props.flHFReference); - break; - - case EAXREVERB_LFREFERENCE: - defer3<LFReferenceValidator>(call, props, props.flLFReference); - break; - - case EAXREVERB_ROOMROLLOFFFACTOR: - defer3<RoomRolloffFactorValidator>(call, props, props.flRoomRolloffFactor); - break; - - case EAXREVERB_FLAGS: - defer3<FlagsValidator3>(call, props, props.ulFlags); - break; - - default: - fail_unknown_property_id(); + case EAXREVERB_NONE: break; + case EAXREVERB_ALLPARAMETERS: defer<AllValidator3>(call, props); break; + case EAXREVERB_ENVIRONMENT: defer<EnvironmentValidator3, EnvironmentDeferrer3>(call, props, props.ulEnvironment); break; + case EAXREVERB_ENVIRONMENTSIZE: defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer3>(call, props, props.flEnvironmentSize); break; + case EAXREVERB_ENVIRONMENTDIFFUSION: defer3<EnvironmentDiffusionValidator>(call, props, props.flEnvironmentDiffusion); break; + case EAXREVERB_ROOM: defer3<RoomValidator>(call, props, props.lRoom); break; + case EAXREVERB_ROOMHF: defer3<RoomHFValidator>(call, props, props.lRoomHF); break; + case EAXREVERB_ROOMLF: defer3<RoomLFValidator>(call, props, props.lRoomLF); break; + case EAXREVERB_DECAYTIME: defer3<DecayTimeValidator>(call, props, props.flDecayTime); break; + case EAXREVERB_DECAYHFRATIO: defer3<DecayHFRatioValidator>(call, props, props.flDecayHFRatio); break; + case EAXREVERB_DECAYLFRATIO: defer3<DecayLFRatioValidator>(call, props, props.flDecayLFRatio); break; + case EAXREVERB_REFLECTIONS: defer3<ReflectionsValidator>(call, props, props.lReflections); break; + case EAXREVERB_REFLECTIONSDELAY: defer3<ReflectionsDelayValidator>(call, props, props.flReflectionsDelay); break; + case EAXREVERB_REFLECTIONSPAN: defer3<VectorValidator>(call, props, props.vReflectionsPan); break; + case EAXREVERB_REVERB: defer3<ReverbValidator>(call, props, props.lReverb); break; + case EAXREVERB_REVERBDELAY: defer3<ReverbDelayValidator>(call, props, props.flReverbDelay); break; + case EAXREVERB_REVERBPAN: defer3<VectorValidator>(call, props, props.vReverbPan); break; + case EAXREVERB_ECHOTIME: defer3<EchoTimeValidator>(call, props, props.flEchoTime); break; + case EAXREVERB_ECHODEPTH: defer3<EchoDepthValidator>(call, props, props.flEchoDepth); break; + case EAXREVERB_MODULATIONTIME: defer3<ModulationTimeValidator>(call, props, props.flModulationTime); break; + case EAXREVERB_MODULATIONDEPTH: defer3<ModulationDepthValidator>(call, props, props.flModulationDepth); break; + case EAXREVERB_AIRABSORPTIONHF: defer3<AirAbsorptionHFValidator>(call, props, props.flAirAbsorptionHF); break; + case EAXREVERB_HFREFERENCE: defer3<HFReferenceValidator>(call, props, props.flHFReference); break; + case EAXREVERB_LFREFERENCE: defer3<LFReferenceValidator>(call, props, props.flLFReference); break; + case EAXREVERB_ROOMROLLOFFFACTOR: defer3<RoomRolloffFactorValidator>(call, props, props.flRoomRolloffFactor); break; + case EAXREVERB_FLAGS: defer3<FlagsValidator3>(call, props, props.ulFlags); break; + default: fail_unknown_property_id(); } } -void EaxReverbCommitter::Set(const EaxCall &call, EaxEffectProps &props) -{ - Set(call, std::get<EAXREVERBPROPERTIES>(props)); -} - #endif // ALSOFT_EAX diff --git a/al/effects/vmorpher.cpp b/al/effects/vmorpher.cpp index b747d216..240c7b54 100644 --- a/al/effects/vmorpher.cpp +++ b/al/effects/vmorpher.cpp @@ -352,9 +352,9 @@ template<> throw Exception{message}; } -bool EaxVocalMorpherCommitter::commit(const EaxEffectProps &props) +bool EaxVocalMorpherCommitter::commit(const EAXVOCALMORPHERPROPERTIES &props) { - if(props == mEaxProps) + if(auto *cur = std::get_if<EAXVOCALMORPHERPROPERTIES>(&mEaxProps); cur && *cur == props) return false; mEaxProps = props; @@ -406,13 +406,12 @@ bool EaxVocalMorpherCommitter::commit(const EaxEffectProps &props) return VMorpherWaveform::Sinusoid; }; - auto &eaxprops = std::get<EAXVOCALMORPHERPROPERTIES>(props); - mAlProps.Vmorpher.PhonemeA = get_phoneme(eaxprops.ulPhonemeA); - mAlProps.Vmorpher.PhonemeACoarseTuning = static_cast<int>(eaxprops.lPhonemeACoarseTuning); - mAlProps.Vmorpher.PhonemeB = get_phoneme(eaxprops.ulPhonemeB); - mAlProps.Vmorpher.PhonemeBCoarseTuning = static_cast<int>(eaxprops.lPhonemeBCoarseTuning); - mAlProps.Vmorpher.Waveform = get_waveform(eaxprops.ulWaveform); - mAlProps.Vmorpher.Rate = eaxprops.flRate; + mAlProps.Vmorpher.PhonemeA = get_phoneme(props.ulPhonemeA); + mAlProps.Vmorpher.PhonemeACoarseTuning = static_cast<int>(props.lPhonemeACoarseTuning); + mAlProps.Vmorpher.PhonemeB = get_phoneme(props.ulPhonemeB); + mAlProps.Vmorpher.PhonemeBCoarseTuning = static_cast<int>(props.lPhonemeBCoarseTuning); + mAlProps.Vmorpher.Waveform = get_waveform(props.ulWaveform); + mAlProps.Vmorpher.Rate = props.flRate; return true; } @@ -433,9 +432,8 @@ void EaxVocalMorpherCommitter::SetDefaults(EaxEffectProps &props) props = defprops; } -void EaxVocalMorpherCommitter::Get(const EaxCall &call, const EaxEffectProps &props_) +void EaxVocalMorpherCommitter::Get(const EaxCall &call, const EAXVOCALMORPHERPROPERTIES &props) { - auto &props = std::get<EAXVOCALMORPHERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXVOCALMORPHER_NONE: break; @@ -450,9 +448,8 @@ void EaxVocalMorpherCommitter::Get(const EaxCall &call, const EaxEffectProps &pr } } -void EaxVocalMorpherCommitter::Set(const EaxCall &call, EaxEffectProps &props_) +void EaxVocalMorpherCommitter::Set(const EaxCall &call, EAXVOCALMORPHERPROPERTIES &props) { - auto &props = std::get<EAXVOCALMORPHERPROPERTIES>(props_); switch(call.get_property_id()) { case EAXVOCALMORPHER_NONE: break; |