🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.1 KiB

  1. #ifndef _AL_FILTER_H_
  2. #define _AL_FILTER_H_
  3. #include "AL/alc.h"
  4. #include "AL/al.h"
  5. #define LOWPASSFREQREF (5000.0f)
  6. #define HIGHPASSFREQREF (250.0f)
  7. struct ALfilter;
  8. struct ALfilterVtable {
  9. void (*const setParami)(ALfilter *filter, ALCcontext *context, ALenum param, ALint val);
  10. void (*const setParamiv)(ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals);
  11. void (*const setParamf)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val);
  12. void (*const setParamfv)(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals);
  13. void (*const getParami)(ALfilter *filter, ALCcontext *context, ALenum param, ALint *val);
  14. void (*const getParamiv)(ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals);
  15. void (*const getParamf)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val);
  16. void (*const getParamfv)(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals);
  17. };
  18. #define DEFINE_ALFILTER_VTABLE(T) \
  19. const ALfilterVtable T##_vtable = { \
  20. T##_setParami, T##_setParamiv, T##_setParamf, T##_setParamfv, \
  21. T##_getParami, T##_getParamiv, T##_getParamf, T##_getParamfv, \
  22. }
  23. struct ALfilter {
  24. // Filter type (AL_FILTER_NULL, ...)
  25. ALenum type;
  26. ALfloat Gain;
  27. ALfloat GainHF;
  28. ALfloat HFReference;
  29. ALfloat GainLF;
  30. ALfloat LFReference;
  31. const ALfilterVtable *vtab;
  32. /* Self ID */
  33. ALuint id;
  34. };
  35. #define ALfilter_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v))
  36. #define ALfilter_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v))
  37. #define ALfilter_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v))
  38. #define ALfilter_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v))
  39. #define ALfilter_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v))
  40. #define ALfilter_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v))
  41. #define ALfilter_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v))
  42. #define ALfilter_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v))
  43. #endif