diff options
author | Chris Robinson <[email protected]> | 2023-01-18 17:02:15 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-01-18 17:02:15 -0800 |
commit | a56b373f2503f9361974fdb836fe4945a6bdbf63 (patch) | |
tree | ec04c63560d0a21bc074590f4126ccefdad18e02 /alc | |
parent | bbf49400da1bd803ca54d2512e5f025ea19d834f (diff) |
Limit pitch shifter pitch between 0.5 and 2.
The current algorithm isn't designed to go beyond that. The course tuning
property is limited to that range as well, though the fine tuning property
could potentially extend it out by half a semitone.
Diffstat (limited to 'alc')
-rw-r--r-- | alc/effects/pshifter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/alc/effects/pshifter.cpp b/alc/effects/pshifter.cpp index 625edc92..6bdcb26b 100644 --- a/alc/effects/pshifter.cpp +++ b/alc/effects/pshifter.cpp @@ -137,7 +137,7 @@ void PshifterState::update(const ContextBase*, const EffectSlot *slot, { const int tune{props->Pshifter.CoarseTune*100 + props->Pshifter.FineTune}; const float pitch{std::pow(2.0f, static_cast<float>(tune) / 1200.0f)}; - mPitchShiftI = fastf2u(pitch*MixerFracOne); + mPitchShiftI = clampu(fastf2u(pitch*MixerFracOne), MixerFracHalf, MixerFracOne*2); mPitchShift = mPitchShiftI * double{1.0/MixerFracOne}; static constexpr auto coeffs = CalcDirectionCoeffs({0.0f, 0.0f, -1.0f}); |