10 #define LOWPASSFREQREF (5000)
21 static __inline ALfloat
lpFilter2P(FILTER
*iir
, ALuint offset
, ALfloat input
)
23 ALfloat
*history
= &iir
->history
[offset
*2];
24 ALfloat a
= iir
->coeff
;
25 ALfloat output
= input
;
27 output
= output
+ (history
[0]-output
)*a
;
29 output
= output
+ (history
[1]-output
)*a
;
35 static __inline ALfloat
lpFilter2PC(const FILTER
*iir
, ALuint offset
, ALfloat input
)
37 const ALfloat
*history
= &iir
->history
[offset
*2];
38 ALfloat a
= iir
->coeff
;
39 ALfloat output
= input
;
41 output
= output
+ (history
[0]-output
)*a
;
42 output
= output
+ (history
[1]-output
)*a
;
47 /* Calculates the low-pass filter coefficient given the pre-scaled gain and
48 * cos(w) value. Note that g should be pre-scaled (sqr(gain) for one-pole,
49 * sqrt(gain) for four-pole, etc) */
50 ALfloat
lpCoeffCalc(ALfloat g
, ALfloat cw
);
53 typedef struct ALfilter
{
54 // Filter type (AL_FILTER_NULL, ...)
60 void (*SetParami
)(struct ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALint val
);
61 void (*SetParamiv
)(struct ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALint
*vals
);
62 void (*SetParamf
)(struct ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat val
);
63 void (*SetParamfv
)(struct ALfilter
*filter
, ALCcontext
*context
, ALenum param
, const ALfloat
*vals
);
65 void (*GetParami
)(struct ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALint
*val
);
66 void (*GetParamiv
)(struct ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALint
*vals
);
67 void (*GetParamf
)(struct ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*val
);
68 void (*GetParamfv
)(struct ALfilter
*filter
, ALCcontext
*context
, ALenum param
, ALfloat
*vals
);
74 #define ALfilter_SetParami(x, c, p, v) ((x)->SetParami((x),(c),(p),(v)))
75 #define ALfilter_SetParamiv(x, c, p, v) ((x)->SetParamiv((x),(c),(p),(v)))
76 #define ALfilter_SetParamf(x, c, p, v) ((x)->SetParamf((x),(c),(p),(v)))
77 #define ALfilter_SetParamfv(x, c, p, v) ((x)->SetParamfv((x),(c),(p),(v)))
79 #define ALfilter_GetParami(x, c, p, v) ((x)->GetParami((x),(c),(p),(v)))
80 #define ALfilter_GetParamiv(x, c, p, v) ((x)->GetParamiv((x),(c),(p),(v)))
81 #define ALfilter_GetParamf(x, c, p, v) ((x)->GetParamf((x),(c),(p),(v)))
82 #define ALfilter_GetParamfv(x, c, p, v) ((x)->GetParamfv((x),(c),(p),(v)))
84 ALvoid
ReleaseALFilters(ALCdevice
*device
);