Free Electron
alFilter.h
1 #ifndef _AL_FILTER_H_
2 #define _AL_FILTER_H_
3 
4 #include "AL/alc.h"
5 #include "AL/al.h"
6 
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10 
11 #define LOWPASSFREQREF (5000.0f)
12 #define HIGHPASSFREQREF (250.0f)
13 
14 
15 struct ALfilter;
16 
17 typedef struct ALfilterVtable {
18  void (*const setParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val);
19  void (*const setParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals);
20  void (*const setParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val);
21  void (*const setParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals);
22 
23  void (*const getParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val);
24  void (*const getParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals);
25  void (*const getParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val);
26  void (*const getParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals);
27 } ALfilterVtable;
28 
29 #define DEFINE_ALFILTER_VTABLE(T) \
30 const struct ALfilterVtable T##_vtable = { \
31  T##_setParami, T##_setParamiv, \
32  T##_setParamf, T##_setParamfv, \
33  T##_getParami, T##_getParamiv, \
34  T##_getParamf, T##_getParamfv, \
35 }
36 
37 typedef struct ALfilter {
38  // Filter type (AL_FILTER_NULL, ...)
39  ALenum type;
40 
41  ALfloat Gain;
42  ALfloat GainHF;
43  ALfloat HFReference;
44  ALfloat GainLF;
45  ALfloat LFReference;
46 
47  const struct ALfilterVtable *vtab;
48 
49  /* Self ID */
50  ALuint id;
51 } ALfilter;
52 #define ALfilter_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v))
53 #define ALfilter_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v))
54 #define ALfilter_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v))
55 #define ALfilter_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v))
56 #define ALfilter_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v))
57 #define ALfilter_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v))
58 #define ALfilter_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v))
59 #define ALfilter_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v))
60 
61 void ReleaseALFilters(ALCdevice *device);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif