Fix a couple property variable names
[openal-soft.git] / OpenAL32 / Include / alEffect.h
blob4d28a70815ca826f0ffa6a658806d9267a6391fa
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_EFFECT = 0,
14 REVERB_EFFECT,
15 CHORUS_EFFECT,
16 COMPRESSOR_EFFECT,
17 DISTORTION_EFFECT,
18 ECHO_EFFECT,
19 EQUALIZER_EFFECT,
20 FLANGER_EFFECT,
21 FSHIFTER_EFFECT,
22 MODULATOR_EFFECT,
23 PSHIFTER_EFFECT,
24 DEDICATED_EFFECT,
26 MAX_EFFECTS
28 extern ALboolean DisabledEffects[MAX_EFFECTS];
30 extern ALfloat ReverbBoost;
32 struct EffectList {
33 const char name[16];
34 int type;
35 ALenum val;
37 #define EFFECTLIST_SIZE 13
38 extern const struct EffectList EffectList[EFFECTLIST_SIZE];
41 struct ALeffectVtable {
42 void (*const setParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint val);
43 void (*const setParamiv)(struct ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals);
44 void (*const setParamf)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val);
45 void (*const setParamfv)(struct ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals);
47 void (*const getParami)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *val);
48 void (*const getParamiv)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals);
49 void (*const getParamf)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val);
50 void (*const getParamfv)(const struct ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals);
53 #define DEFINE_ALEFFECT_VTABLE(T) \
54 const struct ALeffectVtable T##_vtable = { \
55 T##_setParami, T##_setParamiv, \
56 T##_setParamf, T##_setParamfv, \
57 T##_getParami, T##_getParamiv, \
58 T##_getParamf, T##_getParamfv, \
61 extern const struct ALeffectVtable ALeaxreverb_vtable;
62 extern const struct ALeffectVtable ALreverb_vtable;
63 extern const struct ALeffectVtable ALchorus_vtable;
64 extern const struct ALeffectVtable ALcompressor_vtable;
65 extern const struct ALeffectVtable ALdistortion_vtable;
66 extern const struct ALeffectVtable ALecho_vtable;
67 extern const struct ALeffectVtable ALequalizer_vtable;
68 extern const struct ALeffectVtable ALflanger_vtable;
69 extern const struct ALeffectVtable ALfshifter_vtable;
70 extern const struct ALeffectVtable ALmodulator_vtable;
71 extern const struct ALeffectVtable ALnull_vtable;
72 extern const struct ALeffectVtable ALpshifter_vtable;
73 extern const struct ALeffectVtable ALdedicated_vtable;
76 typedef union ALeffectProps {
77 struct {
78 // Shared Reverb Properties
79 ALfloat Density;
80 ALfloat Diffusion;
81 ALfloat Gain;
82 ALfloat GainHF;
83 ALfloat DecayTime;
84 ALfloat DecayHFRatio;
85 ALfloat ReflectionsGain;
86 ALfloat ReflectionsDelay;
87 ALfloat LateReverbGain;
88 ALfloat LateReverbDelay;
89 ALfloat AirAbsorptionGainHF;
90 ALfloat RoomRolloffFactor;
91 ALboolean DecayHFLimit;
93 // Additional EAX Reverb Properties
94 ALfloat GainLF;
95 ALfloat DecayLFRatio;
96 ALfloat ReflectionsPan[3];
97 ALfloat LateReverbPan[3];
98 ALfloat EchoTime;
99 ALfloat EchoDepth;
100 ALfloat ModulationTime;
101 ALfloat ModulationDepth;
102 ALfloat HFReference;
103 ALfloat LFReference;
104 } Reverb;
106 struct {
107 ALint Waveform;
108 ALint Phase;
109 ALfloat Rate;
110 ALfloat Depth;
111 ALfloat Feedback;
112 ALfloat Delay;
113 } Chorus; /* Also Flanger */
115 struct {
116 ALboolean OnOff;
117 } Compressor;
119 struct {
120 ALfloat Edge;
121 ALfloat Gain;
122 ALfloat LowpassCutoff;
123 ALfloat EQCenter;
124 ALfloat EQBandwidth;
125 } Distortion;
127 struct {
128 ALfloat Delay;
129 ALfloat LRDelay;
131 ALfloat Damping;
132 ALfloat Feedback;
134 ALfloat Spread;
135 } Echo;
137 struct {
138 ALfloat LowCutoff;
139 ALfloat LowGain;
140 ALfloat Mid1Center;
141 ALfloat Mid1Gain;
142 ALfloat Mid1Width;
143 ALfloat Mid2Center;
144 ALfloat Mid2Gain;
145 ALfloat Mid2Width;
146 ALfloat HighCutoff;
147 ALfloat HighGain;
148 } Equalizer;
150 struct {
151 ALfloat Frequency;
152 ALint LeftDirection;
153 ALint RightDirection;
154 } Fshifter;
156 struct {
157 ALfloat Frequency;
158 ALfloat HighPassCutoff;
159 ALint Waveform;
160 } Modulator;
162 struct {
163 ALint CoarseTune;
164 ALint FineTune;
165 } Pshifter;
167 struct {
168 ALfloat Gain;
169 } Dedicated;
170 } ALeffectProps;
172 typedef struct ALeffect {
173 // Effect type (AL_EFFECT_NULL, ...)
174 ALenum type;
176 ALeffectProps Props;
178 const struct ALeffectVtable *vtab;
180 /* Self ID */
181 ALuint id;
182 } ALeffect;
183 #define ALeffect_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v))
184 #define ALeffect_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v))
185 #define ALeffect_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v))
186 #define ALeffect_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v))
187 #define ALeffect_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v))
188 #define ALeffect_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v))
189 #define ALeffect_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v))
190 #define ALeffect_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v))
192 inline ALboolean IsReverbEffect(ALenum type)
193 { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; }
195 void InitEffect(ALeffect *effect);
196 void ReleaseALEffects(ALCdevice *device);
198 void LoadReverbPreset(const char *name, ALeffect *effect);
200 #ifdef __cplusplus
202 #endif
204 #endif