Multiply samples with the cubic coeffs before transposing
[openal-soft.git] / OpenAL32 / Include / alEffect.h
blobf656c56a8b1a8f2e133bc70d788895d6d83963b3
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 Delay;
136 ALfloat LowCutoff;
137 ALfloat LowGain;
138 ALfloat Mid1Center;
139 ALfloat Mid1Gain;
140 ALfloat Mid1Width;
141 ALfloat Mid2Center;
142 ALfloat Mid2Gain;
143 ALfloat Mid2Width;
144 ALfloat HighCutoff;
145 ALfloat HighGain;
146 } Equalizer;
148 struct {
149 ALint Waveform;
150 ALint Phase;
151 ALfloat Rate;
152 ALfloat Depth;
153 ALfloat Feedback;
154 ALfloat Delay;
155 } Flanger;
157 struct {
158 ALfloat Frequency;
159 ALfloat HighPassCutoff;
160 ALint Waveform;
161 } Modulator;
163 struct {
164 ALfloat Gain;
165 } Dedicated;
166 } ALeffectProps;
168 typedef struct ALeffect {
169 // Effect type (AL_EFFECT_NULL, ...)
170 ALenum type;
172 ALeffectProps Props;
174 const struct ALeffectVtable *vtbl;
176 /* Self ID */
177 ALuint id;
178 } ALeffect;
180 inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id)
181 { return (struct ALeffect*)LookupUIntMapKey(&device->EffectMap, id); }
182 inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id)
183 { return (struct ALeffect*)RemoveUIntMapKey(&device->EffectMap, id); }
185 inline ALboolean IsReverbEffect(ALenum type)
186 { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; }
188 ALenum InitEffect(ALeffect *effect);
189 ALvoid ReleaseALEffects(ALCdevice *device);
191 ALvoid LoadReverbPreset(const char *name, ALeffect *effect);
193 #ifdef __cplusplus
195 #endif
197 #endif