diff options
author | Chris Robinson <[email protected]> | 2019-07-29 17:54:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-07-29 17:54:07 -0700 |
commit | 4c9e18c5a0c29548eb38db636785aa7064713c5d (patch) | |
tree | 7b7904b9a0c33256ec7f094b31c7ed0cdafc487d /al/filter.h | |
parent | c2de0782cfec62d6a1c3fe2d409d0f64528ae5f7 (diff) |
Rename al/* sources to avoid camel-case
Diffstat (limited to 'al/filter.h')
-rw-r--r-- | al/filter.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/al/filter.h b/al/filter.h new file mode 100644 index 00000000..db098d70 --- /dev/null +++ b/al/filter.h @@ -0,0 +1,56 @@ +#ifndef AL_FILTER_H +#define AL_FILTER_H + +#include "AL/al.h" +#include "AL/alc.h" + + +#define LOWPASSFREQREF (5000.0f) +#define HIGHPASSFREQREF (250.0f) + + +struct ALfilter; + +struct ALfilterVtable { + void (*const setParami)(ALfilter *filter, ALCcontext *context, ALenum param, ALint val); + void (*const setParamiv)(ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals); + void (*const setParamf)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val); + void (*const setParamfv)(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals); + + void (*const getParami)(ALfilter *filter, ALCcontext *context, ALenum param, ALint *val); + void (*const getParamiv)(ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals); + void (*const getParamf)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val); + void (*const getParamfv)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals); +}; + +#define DEFINE_ALFILTER_VTABLE(T) \ +const ALfilterVtable T##_vtable = { \ + T##_setParami, T##_setParamiv, T##_setParamf, T##_setParamfv, \ + T##_getParami, T##_getParamiv, T##_getParamf, T##_getParamfv, \ +} + +struct ALfilter { + // Filter type (AL_FILTER_NULL, ...) + ALenum type; + + ALfloat Gain; + ALfloat GainHF; + ALfloat HFReference; + ALfloat GainLF; + ALfloat LFReference; + + const ALfilterVtable *vtab; + + /* Self ID */ + ALuint id; +}; +#define ALfilter_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v)) +#define ALfilter_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v)) +#define ALfilter_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v)) +#define ALfilter_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v)) +#define ALfilter_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v)) +#define ALfilter_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v)) +#define ALfilter_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v)) +#define ALfilter_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v)) + +#endif |