alEffect.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #ifndef _AL_EFFECT_H_
  2. #define _AL_EFFECT_H_
  3. #include "AL/al.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. enum {
  8. EAXREVERB = 0,
  9. REVERB,
  10. ECHO,
  11. MODULATOR,
  12. DEDICATED,
  13. MAX_EFFECTS
  14. };
  15. extern ALboolean DisabledEffects[MAX_EFFECTS];
  16. extern ALfloat ReverbBoost;
  17. extern ALboolean EmulateEAXReverb;
  18. typedef struct ALeffect
  19. {
  20. // Effect type (AL_EFFECT_NULL, ...)
  21. ALenum type;
  22. struct {
  23. // Shared Reverb Properties
  24. ALfloat Density;
  25. ALfloat Diffusion;
  26. ALfloat Gain;
  27. ALfloat GainHF;
  28. ALfloat DecayTime;
  29. ALfloat DecayHFRatio;
  30. ALfloat ReflectionsGain;
  31. ALfloat ReflectionsDelay;
  32. ALfloat LateReverbGain;
  33. ALfloat LateReverbDelay;
  34. ALfloat AirAbsorptionGainHF;
  35. ALfloat RoomRolloffFactor;
  36. ALboolean DecayHFLimit;
  37. // Additional EAX Reverb Properties
  38. ALfloat GainLF;
  39. ALfloat DecayLFRatio;
  40. ALfloat ReflectionsPan[3];
  41. ALfloat LateReverbPan[3];
  42. ALfloat EchoTime;
  43. ALfloat EchoDepth;
  44. ALfloat ModulationTime;
  45. ALfloat ModulationDepth;
  46. ALfloat HFReference;
  47. ALfloat LFReference;
  48. } Reverb;
  49. struct {
  50. ALfloat Delay;
  51. ALfloat LRDelay;
  52. ALfloat Damping;
  53. ALfloat Feedback;
  54. ALfloat Spread;
  55. } Echo;
  56. struct {
  57. ALfloat Frequency;
  58. ALfloat HighPassCutoff;
  59. ALint Waveform;
  60. } Modulator;
  61. struct {
  62. ALfloat Gain;
  63. } Dedicated;
  64. void (*SetParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint val);
  65. void (*SetParamiv)(struct ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals);
  66. void (*SetParamf)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val);
  67. void (*SetParamfv)(struct ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals);
  68. void (*GetParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *val);
  69. void (*GetParamiv)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals);
  70. void (*GetParamf)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val);
  71. void (*GetParamfv)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals);
  72. // Index to itself
  73. ALuint effect;
  74. } ALeffect;
  75. #define ALeffect_SetParami(x, c, p, v) ((x)->SetParami((x),(c),(p),(v)))
  76. #define ALeffect_SetParamiv(x, c, p, v) ((x)->SetParamiv((x),(c),(p),(v)))
  77. #define ALeffect_SetParamf(x, c, p, v) ((x)->SetParamf((x),(c),(p),(v)))
  78. #define ALeffect_SetParamfv(x, c, p, v) ((x)->SetParamfv((x),(c),(p),(v)))
  79. #define ALeffect_GetParami(x, c, p, v) ((x)->GetParami((x),(c),(p),(v)))
  80. #define ALeffect_GetParamiv(x, c, p, v) ((x)->GetParamiv((x),(c),(p),(v)))
  81. #define ALeffect_GetParamf(x, c, p, v) ((x)->GetParamf((x),(c),(p),(v)))
  82. #define ALeffect_GetParamfv(x, c, p, v) ((x)->GetParamfv((x),(c),(p),(v)))
  83. static __inline ALboolean IsReverbEffect(ALenum type)
  84. { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; }
  85. ALenum InitEffect(ALeffect *effect);
  86. ALvoid ReleaseALEffects(ALCdevice *device);
  87. ALvoid LoadReverbPreset(const char *name, ALeffect *effect);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif