aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2023-02-08 17:32:51 -0800
committerChris Robinson <[email protected]>2023-02-08 17:32:51 -0800
commit233d3f8d15681c62ba18940440ceabe5913cff61 (patch)
tree3865ae9c0369daea034a4bb75b5bdac2b952b62c
parente181b3b75381b1e81a1b0a4129b3ce72fe87fc0d (diff)
Use better panning positions for the frequency shifter effect
-rw-r--r--alc/effects/fshifter.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/alc/effects/fshifter.cpp b/alc/effects/fshifter.cpp
index 4bdb53a7..147f7d08 100644
--- a/alc/effects/fshifter.cpp
+++ b/alc/effects/fshifter.cpp
@@ -163,8 +163,13 @@ void FshifterState::update(const ContextBase *context, const EffectSlot *slot,
break;
}
- static constexpr auto lcoeffs = CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f});
- static constexpr auto rcoeffs = CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f});
+ static constexpr auto inv_sqrt2 = static_cast<float>(1.0 / al::numbers::sqrt2);
+ static constexpr auto lcoeffs_pw = CalcDirectionCoeffs({-1.0f, 0.0f, 0.0f});
+ static constexpr auto rcoeffs_pw = CalcDirectionCoeffs({ 1.0f, 0.0f, 0.0f});
+ static constexpr auto lcoeffs_nrml = CalcDirectionCoeffs({-inv_sqrt2, 0.0f, inv_sqrt2});
+ static constexpr auto rcoeffs_nrml = CalcDirectionCoeffs({ inv_sqrt2, 0.0f, inv_sqrt2});
+ auto &lcoeffs = (device->mRenderMode != RenderMode::Pairwise) ? lcoeffs_nrml : lcoeffs_pw;
+ auto &rcoeffs = (device->mRenderMode != RenderMode::Pairwise) ? rcoeffs_nrml : rcoeffs_pw;
mOutTarget = target.Main->Buffer;
ComputePanGains(target.Main, lcoeffs.data(), slot->Gain, mGains[0].Target);