summaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-05-16 23:34:26 -0700
committerChris Robinson <[email protected]>2009-05-16 23:34:26 -0700
commit1bfa7609d2b27e6ec5928268856a3496723bdeef (patch)
tree1a99d403e7096c2ea4890648d2f03f2ba56a6c7a /OpenAL32
parent7e8501123a092a19b8153f7fdeecef2e0c5f0aa2 (diff)
Make the filter functions global inline, and use it for echo
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alFilter.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h
index 40fff4fd..c0a05d6a 100644
--- a/OpenAL32/Include/alFilter.h
+++ b/OpenAL32/Include/alFilter.h
@@ -13,6 +13,39 @@ typedef struct {
ALfloat history[0];
} FILTER;
+static __inline ALfloat lpFilter4P(FILTER *iir, ALuint offset, ALfloat input)
+{
+ ALfloat *history = &iir->history[offset];
+ ALfloat a = iir->coeff;
+ ALfloat output = input;
+
+ output = output + (history[0]-output)*a;
+ history[0] = output;
+ output = output + (history[1]-output)*a;
+ history[1] = output;
+ output = output + (history[2]-output)*a;
+ history[2] = output;
+ output = output + (history[3]-output)*a;
+ history[3] = output;
+
+ return output;
+}
+
+static __inline ALfloat lpFilter2P(FILTER *iir, ALuint offset, ALfloat input)
+{
+ ALfloat *history = &iir->history[offset];
+ ALfloat a = iir->coeff;
+ ALfloat output = input;
+
+ output = output + (history[0]-output)*a;
+ history[0] = output;
+ output = output + (history[1]-output)*a;
+ history[1] = output;
+
+ return output;
+}
+
+
#define AL_FILTER_TYPE 0x8001
#define AL_FILTER_NULL 0x0000