diff options
author | Chris Robinson <[email protected]> | 2023-03-11 18:15:59 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-03-11 18:15:59 -0800 |
commit | 3f45b3c0c900a6b513d8917cc4df00ca100a7c09 (patch) | |
tree | 372224c950b7fc1be7efc70bff9dea5129297c55 /al/effects/distortion.cpp | |
parent | 368b3db4ebf0284ef9a069bbb1c1387aa1800e82 (diff) |
Avoid copying to a temporary
Diffstat (limited to 'al/effects/distortion.cpp')
-rw-r--r-- | al/effects/distortion.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/al/effects/distortion.cpp b/al/effects/distortion.cpp index 6125c2a4..ee298ddf 100644 --- a/al/effects/distortion.cpp +++ b/al/effects/distortion.cpp @@ -207,21 +207,20 @@ template<> template<> bool DistortionCommitter::commit(const EaxEffectProps &props) { - const auto orig = mEaxProps; - mEaxProps = props; - - if(orig.mType == mEaxProps.mType && mEaxProps.mDistortion.flEdge == props.mDistortion.flEdge + if(props.mType == mEaxProps.mType && mEaxProps.mDistortion.flEdge == props.mDistortion.flEdge && mEaxProps.mDistortion.lGain == props.mDistortion.lGain && mEaxProps.mDistortion.flLowPassCutOff == props.mDistortion.flLowPassCutOff && mEaxProps.mDistortion.flEQCenter == props.mDistortion.flEQCenter && mEaxProps.mDistortion.flEQBandwidth == props.mDistortion.flEQBandwidth) return false; - mAlProps.Distortion.Edge = mEaxProps.mDistortion.flEdge; - mAlProps.Distortion.Gain = level_mb_to_gain(static_cast<float>(mEaxProps.mDistortion.lGain)); - mAlProps.Distortion.LowpassCutoff = mEaxProps.mDistortion.flLowPassCutOff; - mAlProps.Distortion.EQCenter = mEaxProps.mDistortion.flEQCenter; - mAlProps.Distortion.EQBandwidth = mEaxProps.mDistortion.flEdge; + mEaxProps = props; + + mAlProps.Distortion.Edge = props.mDistortion.flEdge; + mAlProps.Distortion.Gain = level_mb_to_gain(static_cast<float>(props.mDistortion.lGain)); + mAlProps.Distortion.LowpassCutoff = props.mDistortion.flLowPassCutOff; + mAlProps.Distortion.EQCenter = props.mDistortion.flEQCenter; + mAlProps.Distortion.EQBandwidth = props.mDistortion.flEdge; return true; } |