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/equalizer.cpp | |
parent | 368b3db4ebf0284ef9a069bbb1c1387aa1800e82 (diff) |
Avoid copying to a temporary
Diffstat (limited to 'al/effects/equalizer.cpp')
-rw-r--r-- | al/effects/equalizer.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/al/effects/equalizer.cpp b/al/effects/equalizer.cpp index 5eea9e6d..7dc703db 100644 --- a/al/effects/equalizer.cpp +++ b/al/effects/equalizer.cpp @@ -322,10 +322,7 @@ template<> template<> bool EqualizerCommitter::commit(const EaxEffectProps &props) { - const auto orig = mEaxProps; - mEaxProps = props; - - if(orig.mType == mEaxProps.mType && mEaxProps.mEqualizer.lLowGain == props.mEqualizer.lLowGain + if(props.mType == mEaxProps.mType && mEaxProps.mEqualizer.lLowGain == props.mEqualizer.lLowGain && mEaxProps.mEqualizer.flLowCutOff == props.mEqualizer.flLowCutOff && mEaxProps.mEqualizer.lMid1Gain == props.mEqualizer.lMid1Gain && mEaxProps.mEqualizer.flMid1Center == props.mEqualizer.flMid1Center @@ -337,16 +334,18 @@ bool EqualizerCommitter::commit(const EaxEffectProps &props) && mEaxProps.mEqualizer.flHighCutOff == props.mEqualizer.flHighCutOff) return false; - mAlProps.Equalizer.LowGain = level_mb_to_gain(static_cast<float>(mEaxProps.mEqualizer.lLowGain)); - mAlProps.Equalizer.LowCutoff = mEaxProps.mEqualizer.flLowCutOff; - mAlProps.Equalizer.Mid1Gain = level_mb_to_gain(static_cast<float>(mEaxProps.mEqualizer.lMid1Gain)); - mAlProps.Equalizer.Mid1Center = mEaxProps.mEqualizer.flMid1Center; - mAlProps.Equalizer.Mid1Width = mEaxProps.mEqualizer.flMid1Width; - mAlProps.Equalizer.Mid2Gain = level_mb_to_gain(static_cast<float>(mEaxProps.mEqualizer.lMid2Gain)); - mAlProps.Equalizer.Mid2Center = mEaxProps.mEqualizer.flMid2Center; - mAlProps.Equalizer.Mid2Width = mEaxProps.mEqualizer.flMid2Width; - mAlProps.Equalizer.HighGain = level_mb_to_gain(static_cast<float>(mEaxProps.mEqualizer.lHighGain)); - mAlProps.Equalizer.HighCutoff = mEaxProps.mEqualizer.flHighCutOff; + mEaxProps = props; + + mAlProps.Equalizer.LowGain = level_mb_to_gain(static_cast<float>(props.mEqualizer.lLowGain)); + mAlProps.Equalizer.LowCutoff = props.mEqualizer.flLowCutOff; + mAlProps.Equalizer.Mid1Gain = level_mb_to_gain(static_cast<float>(props.mEqualizer.lMid1Gain)); + mAlProps.Equalizer.Mid1Center = props.mEqualizer.flMid1Center; + mAlProps.Equalizer.Mid1Width = props.mEqualizer.flMid1Width; + mAlProps.Equalizer.Mid2Gain = level_mb_to_gain(static_cast<float>(props.mEqualizer.lMid2Gain)); + mAlProps.Equalizer.Mid2Center = props.mEqualizer.flMid2Center; + mAlProps.Equalizer.Mid2Width = props.mEqualizer.flMid2Width; + mAlProps.Equalizer.HighGain = level_mb_to_gain(static_cast<float>(props.mEqualizer.lHighGain)); + mAlProps.Equalizer.HighCutoff = props.mEqualizer.flHighCutOff; return true; } |