diff options
author | Chris Robinson <[email protected]> | 2010-11-26 01:07:54 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-11-26 01:07:54 -0800 |
commit | de8b7fbc5fa76327bba59a620fa2c6d946d226db (patch) | |
tree | 35df890590493b3a459030240f96f205f2fc6b82 /OpenAL32/Include | |
parent | 98d78f7ff9a3636567273e4384731debca2ec79f (diff) |
Share the interpolation functions and use them in the reverb effect
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alu.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 4d61b74d..4c05b733 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -182,6 +182,22 @@ static __inline ALint aluCart2LUTpos(ALfloat re, ALfloat im) return pos%LUT_NUM; } +static __inline ALdouble lerp(ALdouble val1, ALdouble val2, ALdouble mu) +{ + val1 += (val2-val1) * mu; + return val1; +} +static __inline ALdouble cubic(ALdouble val0, ALdouble val1, ALdouble val2, ALdouble val3, ALdouble mu) +{ + ALdouble mu2 = mu*mu; + ALdouble a0 = -0.5*val0 + 1.5*val1 + -1.5*val2 + 0.5*val3; + ALdouble a1 = val0 + -2.5*val1 + 2.0*val2 + -0.5*val3; + ALdouble a2 = -0.5*val0 + 0.5*val2; + ALdouble a3 = val1; + + return a0*mu*mu2 + a1*mu2 + a2*mu + a3; +} + struct ALsource; ALvoid aluInitPanning(ALCdevice *Device); |