diff options
Diffstat (limited to 'al/filter.h')
-rw-r--r-- | al/filter.h | 57 |
1 files changed, 20 insertions, 37 deletions
diff --git a/al/filter.h b/al/filter.h index ee6aa30d..123e64b0 100644 --- a/al/filter.h +++ b/al/filter.h @@ -12,26 +12,6 @@ #define HIGHPASSFREQREF 250.0f -struct ALfilter; - -struct ALfilterVtable { - void (*const setParami )(ALfilter *filter, ALCcontext *ctx, ALenum param, int val); - void (*const setParamiv)(ALfilter *filter, ALCcontext *ctx, ALenum param, const int *vals); - void (*const setParamf )(ALfilter *filter, ALCcontext *ctx, ALenum param, float val); - void (*const setParamfv)(ALfilter *filter, ALCcontext *ctx, ALenum param, const float *vals); - - void (*const getParami )(const ALfilter *filter, ALCcontext *ctx, ALenum param, int *val); - void (*const getParamiv)(const ALfilter *filter, ALCcontext *ctx, ALenum param, int *vals); - void (*const getParamf )(const ALfilter *filter, ALCcontext *ctx, ALenum param, float *val); - void (*const getParamfv)(const ALfilter *filter, ALCcontext *ctx, ALenum param, float *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 { ALenum type{AL_FILTER_NULL}; @@ -41,27 +21,30 @@ struct ALfilter { float GainLF{1.0f}; float LFReference{HIGHPASSFREQREF}; - const ALfilterVtable *vtab{nullptr}; + struct Vtable { + void (*const setParami )(ALfilter *filter, ALenum param, int val); + void (*const setParamiv)(ALfilter *filter, ALenum param, const int *vals); + void (*const setParamf )(ALfilter *filter, ALenum param, float val); + void (*const setParamfv)(ALfilter *filter, ALenum param, const float *vals); + + void (*const getParami )(const ALfilter *filter, ALenum param, int *val); + void (*const getParamiv)(const ALfilter *filter, ALenum param, int *vals); + void (*const getParamf )(const ALfilter *filter, ALenum param, float *val); + void (*const getParamfv)(const ALfilter *filter, ALenum param, float *vals); + }; + const Vtable *vtab{nullptr}; /* Self ID */ ALuint id{0}; - inline void setParami(ALCcontext *ctx, ALenum param, int value) - { vtab->setParami(this, ctx, param, value); } - inline void setParamiv(ALCcontext *ctx, ALenum param, const int *values) - { vtab->setParamiv(this, ctx, param, values); } - inline void setParamf(ALCcontext *ctx, ALenum param, float value) - { vtab->setParamf(this, ctx, param, value); } - inline void setParamfv(ALCcontext *ctx, ALenum param, const float *values) - { vtab->setParamfv(this, ctx, param, values); } - inline void getParami(ALCcontext *ctx, ALenum param, int *value) const - { vtab->getParami(this, ctx, param, value); } - inline void getParamiv(ALCcontext *ctx, ALenum param, int *values) const - { vtab->getParamiv(this, ctx, param, values); } - inline void getParamf(ALCcontext *ctx, ALenum param, float *value) const - { vtab->getParamf(this, ctx, param, value); } - inline void getParamfv(ALCcontext *ctx, ALenum param, float *values) const - { vtab->getParamfv(this, ctx, param, values); } + void setParami(ALenum param, int value) { vtab->setParami(this, param, value); } + void setParamiv(ALenum param, const int *values) { vtab->setParamiv(this, param, values); } + void setParamf(ALenum param, float value) { vtab->setParamf(this, param, value); } + void setParamfv(ALenum param, const float *values) { vtab->setParamfv(this, param, values); } + void getParami(ALenum param, int *value) const { vtab->getParami(this, param, value); } + void getParamiv(ALenum param, int *values) const { vtab->getParamiv(this, param, values); } + void getParamf(ALenum param, float *value) const { vtab->getParamf(this, param, value); } + void getParamfv(ALenum param, float *values) const { vtab->getParamfv(this, param, values); } DISABLE_ALLOC() }; |