summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2008-07-26 00:58:54 -0700
committerChris Robinson <[email protected]>2008-07-26 00:58:54 -0700
commit3e0f9cc716392a67a7dfa63ff4785140dc24c93f (patch)
tree92e5626bdc92e5a0fd3c3e1908a6900ffe9765a4
parentc7e49c9f5735df52d4e847529ae9cb23027547e7 (diff)
Make the filter processing function inline
-rw-r--r--Alc/ALu.c36
-rw-r--r--Alc/lpfilter.c38
-rw-r--r--OpenAL32/Include/alFilter.h3
3 files changed, 39 insertions, 38 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index ea0f0dcb..c1377fa7 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -163,6 +163,42 @@ __inline ALuint aluChannelsFromFormat(ALenum format)
}
+static __inline ALfloat lpFilter(FILTER *iir, ALfloat input)
+{
+ unsigned int i;
+ float *hist1_ptr,*hist2_ptr,*coef_ptr;
+ ALfloat output,new_hist,history1,history2;
+
+ coef_ptr = iir->coef; /* coefficient pointer */
+
+ hist1_ptr = iir->history; /* first history */
+ hist2_ptr = hist1_ptr + 1; /* next history */
+
+ /* 1st number of coefficients array is overall input scale factor,
+ * or filter gain */
+ output = input * (*coef_ptr++);
+
+ for(i = 0;i < FILTER_SECTIONS;i++)
+ {
+ history1 = *hist1_ptr; /* history values */
+ history2 = *hist2_ptr;
+
+ output = output - history1 * (*coef_ptr++);
+ new_hist = output - history2 * (*coef_ptr++); /* poles */
+
+ output = new_hist + history1 * (*coef_ptr++);
+ output = output + history2 * (*coef_ptr++); /* zeros */
+
+ *hist2_ptr++ = *hist1_ptr;
+ *hist1_ptr++ = new_hist;
+ hist1_ptr++;
+ hist2_ptr++;
+ }
+
+ return output;
+}
+
+
static __inline ALshort aluF2S(ALfloat Value)
{
ALint i;
diff --git a/Alc/lpfilter.c b/Alc/lpfilter.c
index cf94c9f6..e10b15d7 100644
--- a/Alc/lpfilter.c
+++ b/Alc/lpfilter.c
@@ -12,9 +12,6 @@ By [email protected] (Zxform)
#include "alFilter.h"
-#define FILTER_SECTIONS 2 /* 2 filter sections for 24 db/oct filter */
-
-
static void szxform(
double *a0, double *a1, double *a2, /* numerator coefficients */
double *b0, double *b1, double *b2, /* denominator coefficients */
@@ -43,41 +40,8 @@ static void szxform(
* Returns float value giving the current output.
* --------------------------------------------------------------------
*/
-float lpFilter(FILTER *iir, float input)
-{
- unsigned int i;
- float *hist1_ptr,*hist2_ptr,*coef_ptr;
- float output,new_hist,history1,history2;
-
- coef_ptr = iir->coef; /* coefficient pointer */
-
- hist1_ptr = iir->history; /* first history */
- hist2_ptr = hist1_ptr + 1; /* next history */
-
- /* 1st number of coefficients array is overall input scale factor,
- * or filter gain */
- output = input * (*coef_ptr++);
-
- for(i = 0;i < FILTER_SECTIONS;i++)
- {
- history1 = *hist1_ptr; /* history values */
- history2 = *hist2_ptr;
-
- output = output - history1 * (*coef_ptr++);
- new_hist = output - history2 * (*coef_ptr++); /* poles */
-
- output = new_hist + history1 * (*coef_ptr++);
- output = output + history2 * (*coef_ptr++); /* zeros */
-
- *hist2_ptr++ = *hist1_ptr;
- *hist1_ptr++ = new_hist;
- hist1_ptr++;
- hist2_ptr++;
- }
-
- return output;
-}
+/*** moved to ALu.c ***/
/*
* --------------------------------------------------------------------
diff --git a/OpenAL32/Include/alFilter.h b/OpenAL32/Include/alFilter.h
index f1d24d0f..c57dabb0 100644
--- a/OpenAL32/Include/alFilter.h
+++ b/OpenAL32/Include/alFilter.h
@@ -53,7 +53,8 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pf
ALvoid ReleaseALFilters(ALvoid);
-float lpFilter(FILTER *iir, float input);
+#define FILTER_SECTIONS 2 /* 2 filter sections for 24 db/oct filter */
+
int InitLowPassFilter(ALCcontext *Context, FILTER *iir);
#ifdef __cplusplus