diff options
author | Chris Robinson <[email protected]> | 2015-09-29 18:27:11 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-09-29 20:39:12 -0700 |
commit | dc10e56babf61b62c6cc779414103d7183100c58 (patch) | |
tree | 302dd43223b8c3678cbc726655de628bf5b617fb /OpenAL32/Include/alu.h | |
parent | e13d553aefe68f63c1c7d479df80c44f4ab70a0f (diff) |
Implement a 6-point sinc-lanczos filter
Diffstat (limited to 'OpenAL32/Include/alu.h')
-rw-r--r-- | OpenAL32/Include/alu.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 16b3e1ab..c37ebb9f 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -202,7 +202,11 @@ inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max) { return minu64(max, maxu64(min, val)); } -extern alignas(16) ALfloat ResampleCoeffs[FRACTIONONE][4]; +union ResamplerCoeffs { + ALfloat FIR4[FRACTIONONE][4]; + ALfloat FIR6[FRACTIONONE][6]; +}; +extern alignas(16) union ResamplerCoeffs ResampleCoeffs; inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) @@ -211,9 +215,14 @@ inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) } inline ALfloat resample_fir4(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALuint frac) { - const ALfloat *k = ResampleCoeffs[frac]; + const ALfloat *k = ResampleCoeffs.FIR4[frac]; return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3; } +inline ALfloat resample_fir6(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat val5, ALuint frac) +{ + const ALfloat *k = ResampleCoeffs.FIR6[frac]; + return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3 + k[4]*val4 + k[5]*val5; +} void aluInitMixer(void); |