aboutsummaryrefslogtreecommitdiffstats
path: root/al/effects/distortion.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-12-23 00:11:26 -0800
committerChris Robinson <[email protected]>2023-12-23 00:11:26 -0800
commitd7304c49a1d2cea2dae0ae38fdd9706dbcdb561f (patch)
tree251aede4876ca8d143fb1d1e6aedb4e3cc4f2818 /al/effects/distortion.cpp
parentc253a4353227be00ecd7995b8c7443ebfcd6d5a9 (diff)
Pass the effect props directly to the eax committer functions
Rather than the variant that was already checked for what it's holding.
Diffstat (limited to 'al/effects/distortion.cpp')
-rw-r--r--al/effects/distortion.cpp21
1 files changed, 9 insertions, 12 deletions
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;