mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 16:54:03 +02:00
Add some validation to the resampler.
This commit is contained in:
+12
@@ -49681,6 +49681,14 @@ MA_API ma_result ma_linear_resampler_set_rate_ratio(ma_linear_resampler* pResamp
|
|||||||
ma_uint32 n;
|
ma_uint32 n;
|
||||||
ma_uint32 d;
|
ma_uint32 d;
|
||||||
|
|
||||||
|
if (pResampler == NULL) {
|
||||||
|
return MA_INVALID_ARGS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ratioInOut <= 0) {
|
||||||
|
return MA_INVALID_ARGS;
|
||||||
|
}
|
||||||
|
|
||||||
d = 1000;
|
d = 1000;
|
||||||
n = (ma_uint32)(ratioInOut * d);
|
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;
|
return MA_INVALID_ARGS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ratio <= 0) {
|
||||||
|
return MA_INVALID_ARGS;
|
||||||
|
}
|
||||||
|
|
||||||
d = 1000;
|
d = 1000;
|
||||||
n = (ma_uint32)(ratio * d);
|
n = (ma_uint32)(ratio * d);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user