aboutsummaryrefslogtreecommitdiffstats
path: root/al/effects/vmorpher.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/vmorpher.cpp
parent368b3db4ebf0284ef9a069bbb1c1387aa1800e82 (diff)
Avoid copying to a temporary
Diffstat (limited to 'al/effects/vmorpher.cpp')
-rw-r--r--al/effects/vmorpher.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/al/effects/vmorpher.cpp b/al/effects/vmorpher.cpp
index 856fc6b3..21ea3680 100644
--- a/al/effects/vmorpher.cpp
+++ b/al/effects/vmorpher.cpp
@@ -355,10 +355,7 @@ template<>
template<>
bool VocalMorpherCommitter::commit(const EaxEffectProps &props)
{
- const auto orig = mEaxProps;
- mEaxProps = props;
-
- if(orig.mType == mEaxProps.mType
+ if(props.mType == mEaxProps.mType
&& mEaxProps.mVocalMorpher.ulPhonemeA == props.mVocalMorpher.ulPhonemeA
&& mEaxProps.mVocalMorpher.lPhonemeACoarseTuning == props.mVocalMorpher.lPhonemeACoarseTuning
&& mEaxProps.mVocalMorpher.ulPhonemeB == props.mVocalMorpher.ulPhonemeB
@@ -367,6 +364,8 @@ bool VocalMorpherCommitter::commit(const EaxEffectProps &props)
&& mEaxProps.mVocalMorpher.flRate == props.mVocalMorpher.flRate)
return false;
+ mEaxProps = props;
+
auto get_phoneme = [](unsigned long phoneme) noexcept
{
#define HANDLE_PHENOME(x) case x: return VMorpherPhenome::x
@@ -414,12 +413,12 @@ bool VocalMorpherCommitter::commit(const EaxEffectProps &props)
return VMorpherWaveform::Sinusoid;
};
- mAlProps.Vmorpher.PhonemeA = get_phoneme(mEaxProps.mVocalMorpher.ulPhonemeA);
- mAlProps.Vmorpher.PhonemeACoarseTuning = static_cast<ALint>(mEaxProps.mVocalMorpher.lPhonemeACoarseTuning);
- mAlProps.Vmorpher.PhonemeB = get_phoneme(mEaxProps.mVocalMorpher.ulPhonemeB);
- mAlProps.Vmorpher.PhonemeBCoarseTuning = static_cast<ALint>(mEaxProps.mVocalMorpher.lPhonemeBCoarseTuning);
- mAlProps.Vmorpher.Waveform = get_waveform(mEaxProps.mVocalMorpher.ulWaveform);
- mAlProps.Vmorpher.Rate = mEaxProps.mVocalMorpher.flRate;
+ mAlProps.Vmorpher.PhonemeA = get_phoneme(props.mVocalMorpher.ulPhonemeA);
+ mAlProps.Vmorpher.PhonemeACoarseTuning = static_cast<int>(props.mVocalMorpher.lPhonemeACoarseTuning);
+ mAlProps.Vmorpher.PhonemeB = get_phoneme(props.mVocalMorpher.ulPhonemeB);
+ mAlProps.Vmorpher.PhonemeBCoarseTuning = static_cast<int>(props.mVocalMorpher.lPhonemeBCoarseTuning);
+ mAlProps.Vmorpher.Waveform = get_waveform(props.mVocalMorpher.ulWaveform);
+ mAlProps.Vmorpher.Rate = props.mVocalMorpher.flRate;
return true;
}