aboutsummaryrefslogtreecommitdiffstats
path: root/al/effects/modulator.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/modulator.cpp
parent368b3db4ebf0284ef9a069bbb1c1387aa1800e82 (diff)
Avoid copying to a temporary
Diffstat (limited to 'al/effects/modulator.cpp')
-rw-r--r--al/effects/modulator.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/al/effects/modulator.cpp b/al/effects/modulator.cpp
index 8b6b1045..5f37d08f 100644
--- a/al/effects/modulator.cpp
+++ b/al/effects/modulator.cpp
@@ -206,15 +206,14 @@ template<>
template<>
bool ModulatorCommitter::commit(const EaxEffectProps &props)
{
- const auto orig = mEaxProps;
- mEaxProps = props;
-
- if(orig.mType == mEaxProps.mType
+ if(props.mType == mEaxProps.mType
&& mEaxProps.mModulator.flFrequency == props.mModulator.flFrequency
&& mEaxProps.mModulator.flHighPassCutOff == props.mModulator.flHighPassCutOff
&& mEaxProps.mModulator.ulWaveform == props.mModulator.ulWaveform)
return false;
+ mEaxProps = props;
+
auto get_waveform = [](unsigned long form)
{
if(form == EAX_RINGMODULATOR_SINUSOID)
@@ -226,9 +225,9 @@ bool ModulatorCommitter::commit(const EaxEffectProps &props)
return ModulatorWaveform::Sinusoid;
};
- mAlProps.Modulator.Frequency = mEaxProps.mModulator.flFrequency;
- mAlProps.Modulator.HighPassCutoff = mEaxProps.mModulator.flHighPassCutOff;
- mAlProps.Modulator.Waveform = get_waveform(mEaxProps.mModulator.ulWaveform);
+ mAlProps.Modulator.Frequency = props.mModulator.flFrequency;
+ mAlProps.Modulator.HighPassCutoff = props.mModulator.flHighPassCutOff;
+ mAlProps.Modulator.Waveform = get_waveform(props.mModulator.ulWaveform);
return true;
}