Commit 705e54c6 authored by David Reid's avatar David Reid

Add support for s16 format to the linear resampler.

parent 1449edf4
......@@ -4278,6 +4278,18 @@ static MA_INLINE float ma_mix_f32_fast(float x, float y, float a)
/*return x + (y - x)*a;*/
}
static MA_INLINE ma_int32 ma_mix_s32_fast(ma_int32 x, ma_int32 y, float a)
{
ma_int32 r0 = (y - x);
ma_int32 r1 = (ma_int32)(r0*a);
return x + r1;
}
static MA_INLINE ma_int32 ma_mix_s16_fast(ma_int32 x, ma_int32 y, float a)
{
return (ma_int16)ma_mix_s32_fast(x, y, a);
}
#if defined(MA_SUPPORT_SSE2)
static MA_INLINE __m128 ma_mix_f32_fast__sse2(__m128 x, __m128 y, __m128 a)
{
......@@ -119,8 +119,8 @@ ma_result ma_biquad_init(const ma_biquad_config* pConfig, ma_biquad* pBQ)
return MA_INVALID_ARGS; /* Division by zero. */
}
/* Currently only supporting f32, but support for other formats will be added later. */
if (pConfig->format != ma_format_f32) {
/* Currently only supporting f32 and s16, but support for other formats will be added later. */
if (pConfig->format != ma_format_f32 && pConfig->format != ma_format_s16) {
return MA_INVALID_ARGS;
}
......@@ -243,7 +243,7 @@ ma_result ma_lpf_init(const ma_lpf_config* pConfig, ma_lpf* pLPF)
bqConfig.b1 = (double)( 1 - c);
bqConfig.b2 = (double)((1 - c) / 2);
bqConfig.format = pConfig->format;
bqConfig.format = pConfig->format;
bqConfig.channels = pConfig->channels;
result = ma_biquad_init(&bqConfig, &pLPF->bq);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment