aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALu.c1
-rw-r--r--Alc/mixer_c.c10
-rw-r--r--OpenAL32/Include/alu.h9
3 files changed, 11 insertions, 9 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 97066737..e5c44a96 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -69,6 +69,7 @@ extern inline ALuint64 maxu64(ALuint64 a, ALuint64 b);
extern inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max);
extern inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu);
+extern inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu);
extern inline void aluVectorSet(aluVector *restrict vector, ALfloat x, ALfloat y, ALfloat z, ALfloat w);
diff --git a/Alc/mixer_c.c b/Alc/mixer_c.c
index 41445fc4..0bb93e8a 100644
--- a/Alc/mixer_c.c
+++ b/Alc/mixer_c.c
@@ -13,15 +13,7 @@ static inline ALfloat do_point(const ALfloat *restrict vals, ALsizei UNUSED(frac
static inline ALfloat do_lerp(const ALfloat *restrict vals, ALsizei frac)
{ return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); }
static inline ALfloat do_cubic(const ALfloat *restrict vals, ALsizei frac)
-{
- ALfloat mu = frac * (1.0f/FRACTIONONE);
- ALfloat mu2 = mu*mu, mu3 = mu2*mu;
- ALfloat a0 = -0.5f*mu3 + mu2 + -0.5f*mu;
- ALfloat a1 = 1.5f*mu3 + -2.5f*mu2 + 1.0f;
- ALfloat a2 = -1.5f*mu3 + 2.0f*mu2 + 0.5f*mu;
- ALfloat a3 = 0.5f*mu3 + -0.5f*mu2;
- return vals[0]*a0 + vals[1]*a1 + vals[2]*a2 + vals[3]*a3;
-}
+{ return cubic(vals[0], vals[1], vals[2], vals[3], frac * (1.0f/FRACTIONONE)); }
const ALfloat *Resample_copy_C(const InterpState* UNUSED(state),
const ALfloat *restrict src, ALsizei UNUSED(frac), ALint UNUSED(increment),
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 2c326327..3fc677b2 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -391,6 +391,15 @@ inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu)
{
return val1 + (val2-val1)*mu;
}
+inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu)
+{
+ ALfloat mu2 = mu*mu, mu3 = mu2*mu;
+ ALfloat a0 = -0.5f*mu3 + mu2 + -0.5f*mu;
+ ALfloat a1 = 1.5f*mu3 + -2.5f*mu2 + 1.0f;
+ ALfloat a2 = -1.5f*mu3 + 2.0f*mu2 + 0.5f*mu;
+ ALfloat a3 = 0.5f*mu3 + -0.5f*mu2;
+ return val1*a0 + val2*a1 + val3*a2 + val4*a3;
+}
enum HrtfRequestMode {