zenilib: zenilib/jni/external/openal-soft/OpenAL32/Include/alFilter.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
alFilter.h
Go to the documentation of this file.
1 #ifndef _AL_FILTER_H_
2 #define _AL_FILTER_H_
3
4 #include "alMain.h"
5
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9
10 #define LOWPASSFREQREF (5000)
11
12 typedef struct {
13 ALfloat coeff;
14 #ifndef _MSC_VER
15 ALfloat history[0];
16 #else
17 ALfloat history[1];
18 #endif
19 } FILTER;
20
21 static __inline ALfloat lpFilter2P(FILTER *iir, ALuint offset, ALfloat input)
22 {
23 ALfloat *history = &iir->history[offset*2];
24 ALfloat a = iir->coeff;
25 ALfloat output = input;
26
27 output = output + (history[0]-output)*a;
28 history[0] = output;
29 output = output + (history[1]-output)*a;
30 history[1] = output;
31
32 return output;
33 }
34
35 static __inline ALfloat lpFilter2PC(const FILTER *iir, ALuint offset, ALfloat input)
36 {
37 const ALfloat *history = &iir->history[offset*2];
38 ALfloat a = iir->coeff;
39 ALfloat output = input;
40
41 output = output + (history[0]-output)*a;
42 output = output + (history[1]-output)*a;
43
44 return output;
45 }
46
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);
51
52
53 typedef struct ALfilter {
54 // Filter type (AL_FILTER_NULL, ...)
55 ALenum type;
56
57 ALfloat Gain;
58 ALfloat GainHF;
59
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);
64
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);
69
70 /* Self ID */
71 ALuint id;
72 } ALfilter;
73
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)))
78
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)))
83
84 ALvoid ReleaseALFilters(ALCdevice *device);
85
86 #ifdef __cplusplus
87 }
88 #endif
89
90 #endif
FILTER::coeff
ALfloat coeff
Definition: alFilter.h:13
val
GLuint const GLfloat * val
Definition: glew.h:2715
ALvoid
void ALvoid
Definition: al.h:74
param
GLenum GLint param
Definition: gl2ext.h:1491
FILTER::history
ALfloat history[0]
Definition: alFilter.h:15
void
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
filter
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: gl2ext.h:961
ALfilter::SetParamfv
void(* SetParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals)
Definition: alFilter.h:63
g
GLboolean GLboolean g
Definition: glew.h:8736
ALfilter::id
ALuint id
Definition: alFilter.h:71
lpCoeffCalc
ALfloat lpCoeffCalc(ALfloat g, ALfloat cw)
Definition: alFilter.c:329
ALfilter::SetParamiv
void(* SetParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals)
Definition: alFilter.h:61
ALCdevice_struct
Definition: alMain.h:560
ALint
int ALint
Definition: al.h:56
ALfilter
struct ALfilter ALfilter
a
GLboolean GLboolean GLboolean GLboolean a
Definition: glew.h:8736
ALfloat
float ALfloat
Definition: al.h:68
lpFilter2P
static __inline ALfloat lpFilter2P(FILTER *iir, ALuint offset, ALfloat input)
Definition: alFilter.h:21
ALfilter::type
ALenum type
Definition: alFilter.h:55
alMain.h
ALfilter::SetParamf
void(* SetParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val)
Definition: alFilter.h:62
ALfilter::SetParami
void(* SetParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val)
Definition: alFilter.h:60
FILTER
Definition: alFilter.h:12
ALfilter::Gain
ALfloat Gain
Definition: alFilter.h:57
ALfilter::GainHF
ALfloat GainHF
Definition: alFilter.h:58
ALenum
int ALenum
Definition: al.h:65
ALfilter::GetParamf
void(* GetParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val)
Definition: alFilter.h:67
ALuint
unsigned int ALuint
Definition: al.h:59
input
GLenum GLenum GLenum input
Definition: glew.h:12631
offset
GLintptr offset
Definition: glew.h:1668
sort_controllers.output
tuple output
Definition: sort_controllers.py:10
ALfilter::GetParamfv
void(* GetParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals)
Definition: alFilter.h:68
ALCcontext_struct
Definition: alMain.h:675
ALfilter::GetParamiv
void(* GetParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals)
Definition: alFilter.h:66
context
TParseContext * context
Definition: glslang_tab.cpp:1907
ALfilter
Definition: alFilter.h:53
lpFilter2PC
static __inline ALfloat lpFilter2PC(const FILTER *iir, ALuint offset, ALfloat input)
Definition: alFilter.h:35
ReleaseALFilters
ALvoid ReleaseALFilters(ALCdevice *device)
Definition: alFilter.c:424
ALfilter::GetParami
void(* GetParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val)
Definition: alFilter.h:65