diff options
author | Chris Robinson <[email protected]> | 2012-09-14 04:13:18 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-09-14 04:13:18 -0700 |
commit | 7635afcb520747b74b7c65bb522016c2c7c2da4d (patch) | |
tree | 85eba69b24c5c089730636c10aa46dda361cc86a /Alc/mixer_c.c | |
parent | 74aee374a646aec1b1ebe40f9efbae692e9720d6 (diff) |
Use a source param for the resampler and move them to the mixer source
Diffstat (limited to 'Alc/mixer_c.c')
-rw-r--r-- | Alc/mixer_c.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c index fab13c0f..f3e416a0 100644 --- a/Alc/mixer_c.c +++ b/Alc/mixer_c.c @@ -6,6 +6,41 @@ #include "alu.h" +static __inline ALfloat point32(const ALfloat *vals, ALint step, ALint frac) +{ return vals[0]; (void)step; (void)frac; } +static __inline ALfloat lerp32(const ALfloat *vals, ALint step, ALint frac) +{ return lerp(vals[0], vals[step], frac * (1.0f/FRACTIONONE)); } +static __inline ALfloat cubic32(const ALfloat *vals, ALint step, ALint frac) +{ return cubic(vals[-step], vals[0], vals[step], vals[step+step], + frac * (1.0f/FRACTIONONE)); } + +#define DECL_TEMPLATE(Sampler) \ +void Resample_##Sampler##_C(const ALfloat *data, ALuint frac, \ + ALuint increment, ALuint NumChannels, ALfloat *RESTRICT OutBuffer, \ + ALuint BufferSize) \ +{ \ + ALuint pos = 0; \ + ALfloat value; \ + ALuint i; \ + \ + for(i = 0;i < BufferSize+1;i++) \ + { \ + value = Sampler(data + pos*NumChannels, NumChannels, frac); \ + OutBuffer[i] = value; \ + \ + frac += increment; \ + pos += frac>>FRACTIONBITS; \ + frac &= FRACTIONMASK; \ + } \ +} + +DECL_TEMPLATE(point32) +DECL_TEMPLATE(lerp32) +DECL_TEMPLATE(cubic32) + +#undef DECL_TEMPLATE + + static __inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*RESTRICT Values)[2], const ALuint IrSize, ALfloat (*RESTRICT Coeffs)[2], |