From 5d0f21448e618243ff9ae2956be1fb72bb6e508a Mon Sep 17 00:00:00 2001 From: David Reid Date: Sun, 19 Jan 2020 21:29:43 +1000 Subject: [PATCH] Remove MA_RESAMPLER_MIN_RATIO and MA_RESAMPLER_MAX_RATIO. --- research/ma_resampler.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/research/ma_resampler.h b/research/ma_resampler.h index 6b419ce5..df210082 100644 --- a/research/ma_resampler.h +++ b/research/ma_resampler.h @@ -236,13 +236,6 @@ Implementation */ #ifdef MINIAUDIO_IMPLEMENTATION -#ifndef MA_RESAMPLER_MIN_RATIO -#define MA_RESAMPLER_MIN_RATIO 0.02083333 -#endif -#ifndef MA_RESAMPLER_MAX_RATIO -#define MA_RESAMPLER_MAX_RATIO 48.0 -#endif - #if defined(ma_speex_resampler_h) #define MA_HAS_SPEEX_RESAMPLER @@ -259,7 +252,7 @@ static ma_result ma_result_from_speex_err(int err) default: return MA_ERROR; } } -#endif +#endif /* ma_speex_resampler_h */ ma_resampler_config ma_resampler_config_init(ma_format format, ma_uint32 channels, ma_uint32 sampleRateIn, ma_uint32 sampleRateOut, ma_resample_algorithm algorithm) { @@ -837,13 +830,13 @@ ma_result ma_resampler_set_rate_ratio(ma_resampler* pResampler, float ratio) ma_uint32 d; ma_uint32 gcf; - if (ratio < MA_RESAMPLER_MIN_RATIO || ratio > MA_RESAMPLER_MAX_RATIO) { - return MA_INVALID_ARGS; - } - d = 1000000; n = (ma_uint32)(ratio * d); + if (n == 0) { + return MA_INVALID_ARGS; /* Ratio too small. */ + } + MA_ASSERT(n != 0); gcf = ma_gcf_u32(n, d);