aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-01-07 17:24:29 -0800
committerChris Robinson <[email protected]>2018-01-07 17:24:29 -0800
commit70973035dea8a65630a7c2548dd8e85d87bd36a9 (patch)
treea35e689a283dbbe93639d9b81a7c569c46a9c4b9 /OpenAL32
parentc8a30592e81b5ae15a35a0e9f52c395fa75ca752 (diff)
Use a separate function to get the cubic value
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alu.h9
1 files changed, 9 insertions, 0 deletions
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 {