From a56b373f2503f9361974fdb836fe4945a6bdbf63 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 18 Jan 2023 17:02:15 -0800 Subject: 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. --- alc/effects/pshifter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'alc/effects/pshifter.cpp') 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(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}); -- cgit v1.2.3