Fix an overflow bug in the s16 biquad pipeline.

This commit is contained in:
David Reid
2020-01-28 21:54:15 +10:00
parent 040dcf8d2c
commit b9c2509d78
+1 -1
View File
@@ -249,7 +249,7 @@ static MA_INLINE void ma_biquad_process_pcm_frame_s16__direct_form_2_transposed(
r1 = b1*x - a1*y + r2;
r2 = b2*x - a2*y;
pY[c] = (ma_int16)(y * 32767.0f); /* f32 -> s16 */
pY[c] = (ma_int16)ma_clamp((ma_int32)(y * 32767.0f), -32768, 32767); /* f32 -> s16 */
pBQ->r1[c].f32 = r1;
pBQ->r2[c].f32 = r2;
}