🛠️🐜 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.

92 lines
3.1 KiB

  1. #ifndef AL_EFFECTS_EFFECTS_H
  2. #define AL_EFFECTS_EFFECTS_H
  3. #include "AL/al.h"
  4. #include "core/except.h"
  5. #ifdef ALSOFT_EAX
  6. #include "al/eax_effect.h"
  7. #endif // ALSOFT_EAX
  8. union EffectProps;
  9. class effect_exception final : public al::base_exception {
  10. ALenum mErrorCode;
  11. public:
  12. #ifdef __USE_MINGW_ANSI_STDIO
  13. [[gnu::format(gnu_printf, 3, 4)]]
  14. #else
  15. [[gnu::format(printf, 3, 4)]]
  16. #endif
  17. effect_exception(ALenum code, const char *msg, ...);
  18. ALenum errorCode() const noexcept { return mErrorCode; }
  19. };
  20. struct EffectVtable {
  21. void (*const setParami)(EffectProps *props, ALenum param, int val);
  22. void (*const setParamiv)(EffectProps *props, ALenum param, const int *vals);
  23. void (*const setParamf)(EffectProps *props, ALenum param, float val);
  24. void (*const setParamfv)(EffectProps *props, ALenum param, const float *vals);
  25. void (*const getParami)(const EffectProps *props, ALenum param, int *val);
  26. void (*const getParamiv)(const EffectProps *props, ALenum param, int *vals);
  27. void (*const getParamf)(const EffectProps *props, ALenum param, float *val);
  28. void (*const getParamfv)(const EffectProps *props, ALenum param, float *vals);
  29. };
  30. #define DEFINE_ALEFFECT_VTABLE(T) \
  31. const EffectVtable T##EffectVtable = { \
  32. T##_setParami, T##_setParamiv, \
  33. T##_setParamf, T##_setParamfv, \
  34. T##_getParami, T##_getParamiv, \
  35. T##_getParamf, T##_getParamfv, \
  36. }
  37. /* Default properties for the given effect types. */
  38. extern const EffectProps NullEffectProps;
  39. extern const EffectProps ReverbEffectProps;
  40. extern const EffectProps StdReverbEffectProps;
  41. extern const EffectProps AutowahEffectProps;
  42. extern const EffectProps ChorusEffectProps;
  43. extern const EffectProps CompressorEffectProps;
  44. extern const EffectProps DistortionEffectProps;
  45. extern const EffectProps EchoEffectProps;
  46. extern const EffectProps EqualizerEffectProps;
  47. extern const EffectProps FlangerEffectProps;
  48. extern const EffectProps FshifterEffectProps;
  49. extern const EffectProps ModulatorEffectProps;
  50. extern const EffectProps PshifterEffectProps;
  51. extern const EffectProps VmorpherEffectProps;
  52. extern const EffectProps DedicatedEffectProps;
  53. extern const EffectProps ConvolutionEffectProps;
  54. /* Vtables to get/set properties for the given effect types. */
  55. extern const EffectVtable NullEffectVtable;
  56. extern const EffectVtable ReverbEffectVtable;
  57. extern const EffectVtable StdReverbEffectVtable;
  58. extern const EffectVtable AutowahEffectVtable;
  59. extern const EffectVtable ChorusEffectVtable;
  60. extern const EffectVtable CompressorEffectVtable;
  61. extern const EffectVtable DistortionEffectVtable;
  62. extern const EffectVtable EchoEffectVtable;
  63. extern const EffectVtable EqualizerEffectVtable;
  64. extern const EffectVtable FlangerEffectVtable;
  65. extern const EffectVtable FshifterEffectVtable;
  66. extern const EffectVtable ModulatorEffectVtable;
  67. extern const EffectVtable PshifterEffectVtable;
  68. extern const EffectVtable VmorpherEffectVtable;
  69. extern const EffectVtable DedicatedEffectVtable;
  70. extern const EffectVtable ConvolutionEffectVtable;
  71. #ifdef ALSOFT_EAX
  72. EaxEffectUPtr eax_create_eax_effect(ALenum al_effect_type);
  73. #endif // ALSOFT_EAX
  74. #endif /* AL_EFFECTS_EFFECTS_H */