From 06bbee24492e70bf3d3a18a9823da57a38e7456a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 22 Nov 2009 21:20:27 -0800 Subject: Add a function for 1-pole filtering --- OpenAL32/Include/alFilter.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h index 86ada5ef..754b0b6f 100644 --- a/OpenAL32/Include/alFilter.h +++ b/OpenAL32/Include/alFilter.h @@ -49,6 +49,18 @@ static __inline ALfloat lpFilter2P(FILTER *iir, ALuint offset, ALfloat input) return output; } +static __inline ALfloat lpFilter1P(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; + + return output; +} + #define AL_FILTER_TYPE 0x8001 -- cgit v1.2.3