Add some validation to the resampler.

This commit is contained in:
David Reid
2022-01-14 21:13:13 +10:00
parent aa983db038
commit 28ba62cb9d
+12
View File
@@ -49681,6 +49681,14 @@ MA_API ma_result ma_linear_resampler_set_rate_ratio(ma_linear_resampler* pResamp
ma_uint32 n;
ma_uint32 d;
if (pResampler == NULL) {
return MA_INVALID_ARGS;
}
if (ratioInOut <= 0) {
return MA_INVALID_ARGS;
}
d = 1000;
n = (ma_uint32)(ratioInOut * d);
@@ -50110,6 +50118,10 @@ MA_API ma_result ma_resampler_set_rate_ratio(ma_resampler* pResampler, float rat
return MA_INVALID_ARGS;
}
if (ratio <= 0) {
return MA_INVALID_ARGS;
}
d = 1000;
n = (ma_uint32)(ratio * d);