Resampler: Improve stability when ratio is 1.

This commit is contained in:
David Reid
2026-02-18 13:01:20 +10:00
parent 7e944566c4
commit 0aef190a59
+2 -2
View File
@@ -59889,8 +59889,8 @@ static ma_result ma_linear_resampler_set_rate_internal(ma_linear_resampler* pRes
where we could have a singularity due to `sin(2*pi * cutoff/rate) = sin(pi) = 0`. I'm going to apply where we could have a singularity due to `sin(2*pi * cutoff/rate) = sin(pi) = 0`. I'm going to apply
a small clamp in an attempt to avoid hitting this case. a small clamp in an attempt to avoid hitting this case.
*/ */
lpfCutoffFrequency = ma_min(lpfCutoffFrequency, 0.5 * minSampleRate * (1.0 - 1e-6)); lpfCutoffFrequency = ma_min(lpfCutoffFrequency, 0.5 * minSampleRate * (1.0 - 1e-5));
lpfCutoffFrequency = ma_max(lpfCutoffFrequency, minSampleRate * 1e-6); lpfCutoffFrequency = ma_max(lpfCutoffFrequency, minSampleRate * 1e-5);
/* We now need to update our LPF parameters. */ /* We now need to update our LPF parameters. */
lpfCount = pResampler->lpfOrder / 2; lpfCount = pResampler->lpfOrder / 2;