Document the ambisonic decoder options
[openal-soft.git] / OpenAL32 / Include / alEffect.h
blob91ee782fe2b6a0a0d1cd1f9aeb5b9f5e6518cc55
1 #ifndef _AL_EFFECT_H_
2 #define _AL_EFFECT_H_
4 #include "alMain.h"
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 struct ALeffect;
12 enum {
13 EAXREVERB = 0,
14 REVERB,
15 AUTOWAH,
16 CHORUS,
17 COMPRESSOR,
18 DISTORTION,
19 ECHO,
20 EQUALIZER,
21 FLANGER,
22 MODULATOR,
23 DEDICATED,
25 MAX_EFFECTS
27 extern ALboolean DisabledEffects[MAX_EFFECTS];
29 extern ALfloat ReverbBoost;
30 extern ALboolean EmulateEAXReverb;
32 struct ALeffectVtable {
33 void (*const setParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint val);
34 void (*const setParamiv)(struct ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals);
35 void (*const setParamf)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val);
36 void (*const setParamfv)(struct ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals);
38 void (*const getParami)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *val);
39 void (*const getParamiv)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals);
40 void (*const getParamf)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val);
41 void (*const getParamfv)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals);
44 #define DEFINE_ALEFFECT_VTABLE(T) \
45 const struct ALeffectVtable T##_vtable = { \
46 T##_setParami, T##_setParamiv, \
47 T##_setParamf, T##_setParamfv, \
48 T##_getParami, T##_getParamiv, \
49 T##_getParamf, T##_getParamfv, \
52 extern const struct ALeffectVtable ALeaxreverb_vtable;
53 extern const struct ALeffectVtable ALreverb_vtable;
54 extern const struct ALeffectVtable ALautowah_vtable;
55 extern const struct ALeffectVtable ALchorus_vtable;
56 extern const struct ALeffectVtable ALcompressor_vtable;
57 extern const struct ALeffectVtable ALdistortion_vtable;
58 extern const struct ALeffectVtable ALecho_vtable;
59 extern const struct ALeffectVtable ALequalizer_vtable;
60 extern const struct ALeffectVtable ALflanger_vtable;
61 extern const struct ALeffectVtable ALmodulator_vtable;
62 extern const struct ALeffectVtable ALnull_vtable;
63 extern const struct ALeffectVtable ALdedicated_vtable;
66 typedef union ALeffectProps {
67 struct {
68 // Shared Reverb Properties
69 ALfloat Density;
70 ALfloat Diffusion;
71 ALfloat Gain;
72 ALfloat GainHF;
73 ALfloat DecayTime;
74 ALfloat DecayHFRatio;
75 ALfloat ReflectionsGain;
76 ALfloat ReflectionsDelay;
77 ALfloat LateReverbGain;
78 ALfloat LateReverbDelay;
79 ALfloat AirAbsorptionGainHF;
80 ALfloat RoomRolloffFactor;
81 ALboolean DecayHFLimit;
83 // Additional EAX Reverb Properties
84 ALfloat GainLF;
85 ALfloat DecayLFRatio;
86 ALfloat ReflectionsPan[3];
87 ALfloat LateReverbPan[3];
88 ALfloat EchoTime;
89 ALfloat EchoDepth;
90 ALfloat ModulationTime;
91 ALfloat ModulationDepth;
92 ALfloat HFReference;
93 ALfloat LFReference;
94 } Reverb;
96 struct {
97 ALfloat AttackTime;
98 ALfloat ReleaseTime;
99 ALfloat PeakGain;
100 ALfloat Resonance;
101 } Autowah;
103 struct {
104 ALint Waveform;
105 ALint Phase;
106 ALfloat Rate;
107 ALfloat Depth;
108 ALfloat Feedback;
109 ALfloat Delay;
110 } Chorus;
112 struct {
113 ALboolean OnOff;
114 } Compressor;
116 struct {
117 ALfloat Edge;
118 ALfloat Gain;
119 ALfloat LowpassCutoff;
120 ALfloat EQCenter;
121 ALfloat EQBandwidth;
122 } Distortion;
124 struct {
125 ALfloat Delay;
126 ALfloat LRDelay;
128 ALfloat Damping;
129 ALfloat Feedback;
131 ALfloat Spread;
132 } Echo;
134 struct {
135 ALfloat LowCutoff;
136 ALfloat LowGain;
137 ALfloat Mid1Center;
138 ALfloat Mid1Gain;
139 ALfloat Mid1Width;
140 ALfloat Mid2Center;
141 ALfloat Mid2Gain;
142 ALfloat Mid2Width;
143 ALfloat HighCutoff;
144 ALfloat HighGain;
145 } Equalizer;
147 struct {
148 ALint Waveform;
149 ALint Phase;
150 ALfloat Rate;
151 ALfloat Depth;
152 ALfloat Feedback;
153 ALfloat Delay;
154 } Flanger;
156 struct {
157 ALfloat Frequency;
158 ALfloat HighPassCutoff;
159 ALint Waveform;
160 } Modulator;
162 struct {
163 ALfloat Gain;
164 } Dedicated;
165 } ALeffectProps;
167 typedef struct ALeffect {
168 // Effect type (AL_EFFECT_NULL, ...)
169 ALenum type;
171 ALeffectProps Props;
173 const struct ALeffectVtable *vtbl;
175 /* Self ID */
176 ALuint id;
177 } ALeffect;
179 inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id)
180 { return (struct ALeffect*)LookupUIntMapKey(&device->EffectMap, id); }
181 inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id)
182 { return (struct ALeffect*)RemoveUIntMapKey(&device->EffectMap, id); }
184 inline ALboolean IsReverbEffect(ALenum type)
185 { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; }
187 ALenum InitEffect(ALeffect *effect);
188 ALvoid ReleaseALEffects(ALCdevice *device);
190 ALvoid LoadReverbPreset(const char *name, ALeffect *effect);
192 #ifdef __cplusplus
194 #endif
196 #endif