aboutsummaryrefslogtreecommitdiffstats
path: root/al/effects/fshifter.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-03-11 18:15:59 -0800
committerChris Robinson <[email protected]>2023-03-11 18:15:59 -0800
commit3f45b3c0c900a6b513d8917cc4df00ca100a7c09 (patch)
tree372224c950b7fc1be7efc70bff9dea5129297c55 /al/effects/fshifter.cpp
parent368b3db4ebf0284ef9a069bbb1c1387aa1800e82 (diff)
Avoid copying to a temporary
Diffstat (limited to 'al/effects/fshifter.cpp')
-rw-r--r--al/effects/fshifter.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/al/effects/fshifter.cpp b/al/effects/fshifter.cpp
index 983e83ee..949db203 100644
--- a/al/effects/fshifter.cpp
+++ b/al/effects/fshifter.cpp
@@ -200,15 +200,14 @@ template<>
template<>
bool FrequencyShifterCommitter::commit(const EaxEffectProps &props)
{
- const auto orig = mEaxProps;
- mEaxProps = props;
-
- if(orig.mType == mEaxProps.mType
+ if(props.mType == mEaxProps.mType
&& mEaxProps.mFrequencyShifter.flFrequency == props.mFrequencyShifter.flFrequency
&& mEaxProps.mFrequencyShifter.ulLeftDirection == props.mFrequencyShifter.ulLeftDirection
&& mEaxProps.mFrequencyShifter.ulRightDirection == props.mFrequencyShifter.ulRightDirection)
return false;
+ mEaxProps = props;
+
auto get_direction = [](unsigned long dir) noexcept
{
if(dir == EAX_FREQUENCYSHIFTER_DOWN)
@@ -218,9 +217,9 @@ bool FrequencyShifterCommitter::commit(const EaxEffectProps &props)
return FShifterDirection::Off;
};
- mAlProps.Fshifter.Frequency = mEaxProps.mFrequencyShifter.flFrequency;
- mAlProps.Fshifter.LeftDirection = get_direction(mEaxProps.mFrequencyShifter.ulLeftDirection);
- mAlProps.Fshifter.RightDirection = get_direction(mEaxProps.mFrequencyShifter.ulRightDirection);
+ mAlProps.Fshifter.Frequency = props.mFrequencyShifter.flFrequency;
+ mAlProps.Fshifter.LeftDirection = get_direction(props.mFrequencyShifter.ulLeftDirection);
+ mAlProps.Fshifter.RightDirection = get_direction(props.mFrequencyShifter.ulRightDirection);
return true;
}