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

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