diff options
author | Chris Robinson <[email protected]> | 2023-02-08 17:32:51 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-02-08 17:32:51 -0800 |
commit | 233d3f8d15681c62ba18940440ceabe5913cff61 (patch) | |
tree | 3865ae9c0369daea034a4bb75b5bdac2b952b62c | |
parent | e181b3b75381b1e81a1b0a4129b3ce72fe87fc0d (diff) |
Use better panning positions for the frequency shifter effect
-rw-r--r-- | alc/effects/fshifter.cpp | 9 |
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); |