diff options
author | Chris Robinson <[email protected]> | 2022-08-18 20:37:19 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-08-18 20:37:19 -0700 |
commit | ed9408e53799cefd527bd3079bf1940d5c35bfc9 (patch) | |
tree | 85e87aa1d5bcc342e043e822e6da50c2fbd3bb3b /alc | |
parent | 4f75f9258ca316fdb52db4d61158a8e22b442e46 (diff) |
Inline and precompute some CalcDirectionCoeffs calls
Diffstat (limited to 'alc')
-rw-r--r-- | alc/alu.cpp | 2 | ||||
-rw-r--r-- | alc/effects/chorus.cpp | 4 | ||||
-rw-r--r-- | alc/effects/dedicated.cpp | 2 | ||||
-rw-r--r-- | alc/effects/distortion.cpp | 2 | ||||
-rw-r--r-- | alc/effects/fshifter.cpp | 4 | ||||
-rw-r--r-- | alc/effects/pshifter.cpp | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index 11bae854..6423ee49 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -906,7 +906,7 @@ void CalcPanningAndFilters(Voice *voice, const float xpos, const float ypos, con auto calc_coeffs = [xpos,ypos,zpos](RenderMode mode) { if(mode != RenderMode::Pairwise) - return CalcDirectionCoeffs({xpos, ypos, zpos}, 0.0f); + return CalcDirectionCoeffs({xpos, ypos, zpos}); /* Clamp Y, in case rounding errors caused it to end up outside * of -1...+1. diff --git a/alc/effects/chorus.cpp b/alc/effects/chorus.cpp index c156c74d..e982e7a1 100644 --- a/alc/effects/chorus.cpp +++ b/alc/effects/chorus.cpp @@ -120,8 +120,8 @@ void ChorusState::update(const ContextBase *Context, const EffectSlot *Slot, mFeedback = props->Chorus.Feedback; /* Gains for left and right sides */ - const auto lcoeffs = CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f}, 0.0f); - const auto rcoeffs = CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f}, 0.0f); + static constexpr auto lcoeffs = CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f}); + static constexpr auto rcoeffs = CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f}); mOutTarget = target.Main->Buffer; ComputePanGains(target.Main, lcoeffs.data(), Slot->Gain, mGains[0].Target); diff --git a/alc/effects/dedicated.cpp b/alc/effects/dedicated.cpp index 4d7a39f0..a1c85ecd 100644 --- a/alc/effects/dedicated.cpp +++ b/alc/effects/dedicated.cpp @@ -94,7 +94,7 @@ void DedicatedState::update(const ContextBase*, const EffectSlot *slot, } else { - const auto coeffs = CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f); + static constexpr auto coeffs = CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}); mOutTarget = target.Main->Buffer; ComputePanGains(target.Main, coeffs.data(), Gain, mTargetGains); diff --git a/alc/effects/distortion.cpp b/alc/effects/distortion.cpp index dba13beb..5e277619 100644 --- a/alc/effects/distortion.cpp +++ b/alc/effects/distortion.cpp @@ -95,7 +95,7 @@ void DistortionState::update(const ContextBase *context, const EffectSlot *slot, bandwidth = props->Distortion.EQBandwidth / (cutoff * 0.67f); mBandpass.setParamsFromBandwidth(BiquadType::BandPass, cutoff/frequency/4.0f, 1.0f, bandwidth); - const auto coeffs = CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f); + static constexpr auto coeffs = CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}); mOutTarget = target.Main->Buffer; ComputePanGains(target.Main, coeffs.data(), slot->Gain*props->Distortion.Gain, mGain); diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp index bed6c79f..f2c8f967 100644 --- a/alc/effects/fshifter.cpp +++ b/alc/effects/fshifter.cpp @@ -160,8 +160,8 @@ void FshifterState::update(const ContextBase *context, const EffectSlot *slot, break; } - const auto lcoeffs = CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f}, 0.0f); - const auto rcoeffs = CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f}, 0.0f); + static constexpr auto lcoeffs = CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f}); + static constexpr auto rcoeffs = CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f}); mOutTarget = target.Main->Buffer; ComputePanGains(target.Main, lcoeffs.data(), slot->Gain, mGains[0].Target); diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index fe116222..b1f6d859 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -140,7 +140,7 @@ void PshifterState::update(const ContextBase*, const EffectSlot *slot, mPitchShiftI = fastf2u(pitch*MixerFracOne); mPitchShift = mPitchShiftI * double{1.0/MixerFracOne}; - const auto coeffs = CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}, 0.0f); + static constexpr auto coeffs = CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}); mOutTarget = target.Main->Buffer; ComputePanGains(target.Main, coeffs.data(), slot->Gain, mTargetGains); |