3 * Copyright 2018 Chris Robinson
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #ifndef EAXVECTOR_DEFINED
24 #define EAXVECTOR_DEFINED
25 typedef struct _EAXVECTOR
{
30 /* EAX 4.0 seems to support 4 FXSlots (auxiliary effect slots), while each
31 * buffer/source supports 2 Active FXSlots (auxiliary sends).
33 #define EAX_MAX_FXSLOTS 4
34 #define EAX_MAX_ACTIVE_FXSLOTS 2
36 /* Used by EAXFXSLOT_LOADEFFECT, EAXCONTEXT_PRIMARYFXSLOTID, and EAXSOURCE_ACTIVEFXSLOTID */
37 DEFINE_GUID(EAX_NULL_GUID
, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
40 DEFINE_GUID(EAXPROPERTYID_EAX40_Context
, 0x1d4870ad, 0xdef, 0x43c0, 0xa4, 0xc, 0x52, 0x36, 0x32, 0x29, 0x63, 0x42);
43 EAXCONTEXT_ALLPARAMETERS
,
44 EAXCONTEXT_PRIMARYFXSLOTID
,
45 EAXCONTEXT_DISTANCEFACTOR
,
46 EAXCONTEXT_AIRABSORPTIONHF
,
47 EAXCONTEXT_HFREFERENCE
,
48 EAXCONTEXT_LASTERROR
/* query only, auto-reset? */
49 } EAXCONTEXT_PROPERTY
;
51 #define EAXCONTEXT_PARAMETER_IMMEDIATE 0x00000000
52 #define EAXCONTEXT_PARAMETER_DEFER 0x80000000
53 #define EAXCONTEXT_PARAMETER_COMMITDEFERREDSETTINGS (EAXCONTEXT_NONE | EAXCONTEXT_PARAMETER_IMMEDIATE)
55 /* EAXCONTEXT_ALLPARAMETERS */
56 typedef struct _EAXCONTEXTPROPERTIES
{
57 GUID guidPrimaryFXSlotID
;
58 float flDistanceFactor
;
59 /* NOTE: Not directly supported by OpenAL, but can be applied to each
60 * source's air absorption factor as:
61 * air_absorption_factor *= flAirAbsorptionHF / -5.0f
63 float flAirAbsorptionHF
;
64 /* NOTE: Not supported by OpenAL. */
66 } EAXCONTEXTPROPERTIES
, *LPEAXCONTEXTPROPERTIES
;
68 /* EAXCONTEXT_LASTERROR */
70 #define EAXERR_INVALID_OPERATION (-1)
71 #define EAXERR_INVALID_VALUE (-2)
72 #define EAXERR_NO_EFFECT_LOADED (-3)
73 #define EAXERR_UNKNOWN_EFFECT (-4)
76 /* Also used by EAXSOURCE_ACTIVEFXSLOTID and EAXCONTEXT_PRIMARYFXSLOTID */
77 DEFINE_GUID(EAXPROPERTYID_EAX40_FXSlot0
, 0xc4d79f1e, 0xf1ac, 0x436b, 0xa8, 0x1d, 0xa7, 0x38, 0xe7, 0x04, 0x54, 0x69);
78 DEFINE_GUID(EAXPROPERTYID_EAX40_FXSlot1
, 0x08c00e96, 0x74be, 0x4491, 0x93, 0xaa, 0xe8, 0xad, 0x35, 0xa4, 0x91, 0x17);
79 DEFINE_GUID(EAXPROPERTYID_EAX40_FXSlot2
, 0x1d433b88, 0xf0f6, 0x4637, 0x91, 0x9f, 0x60, 0xe7, 0xe0, 0x6b, 0x5e, 0xdd);
80 DEFINE_GUID(EAXPROPERTYID_EAX40_FXSlot3
, 0xefff08ea, 0xc7d8, 0x44ab, 0x93, 0xad, 0x6d, 0xbd, 0x5f, 0x91, 0x00, 0x64);
82 EAXFXSLOT_PARAMETER
= 0, /* 0x00...0x40 reserved for effect parameters */
83 EAXFXSLOT_NONE
= 0x10000,
84 EAXFXSLOT_ALLPARAMETERS
,
91 /* EAXFXSLOT_ALLPARAMETERS */
92 typedef struct _EAXFXSLOTPROPERTIES
{
97 } EAXFXSLOTPROPERTIES
, *LPEAXFXSLOTPROPERTIES
;
99 /* EAXFXSLOT_LOADEFFECT */
100 DEFINE_GUID(EAX_REVERB_EFFECT
, 0x0cf95c8f, 0xa3cc, 0x4849, 0xb0, 0xb6, 0x83, 0x2e, 0xcc, 0x18, 0x22, 0xdf);
101 DEFINE_GUID(EAX_AGCCOMPRESSOR_EFFECT
, 0xbfb7a01e, 0x7825, 0x4039, 0x92, 0x7f, 0x03, 0xaa, 0xbd, 0xa0, 0xc5, 0x60);
102 DEFINE_GUID(EAX_AUTOWAH_EFFECT
, 0xec3130c0, 0xac7a, 0x11d2, 0x88, 0xdd, 0x00, 0xa0, 0x24, 0xd1, 0x3c, 0xe1);
103 DEFINE_GUID(EAX_CHORUS_EFFECT
, 0xde6d6fe0, 0xac79, 0x11d2, 0x88, 0xdd, 0x00, 0xa0, 0x24, 0xd1, 0x3c, 0xe1);
104 DEFINE_GUID(EAX_DISTORTION_EFFECT
, 0x975a4ce0, 0xac7e, 0x11d2, 0x88, 0xdd, 0x00, 0xa0, 0x24, 0xd1, 0x3c, 0xe1);
105 DEFINE_GUID(EAX_ECHO_EFFECT
, 0x0e9f1bc0, 0xac82, 0x11d2, 0x88, 0xdd, 0x00, 0xa0, 0x24, 0xd1, 0x3c, 0xe1);
106 DEFINE_GUID(EAX_EQUALIZER_EFFECT
, 0x65f94ce0, 0x9793, 0x11d3, 0x93, 0x9d, 0x00, 0xc0, 0xf0, 0x2d, 0xd6, 0xf0);
107 DEFINE_GUID(EAX_FLANGER_EFFECT
, 0xa70007c0, 0x07d2, 0x11d3, 0x9b, 0x1e, 0x00, 0xa0, 0x24, 0xd1, 0x3c, 0xe1);
108 DEFINE_GUID(EAX_FREQUENCYSHIFTER_EFFECT
, 0xdc3e1880, 0x9212, 0x11d3, 0x93, 0x9d, 0x00, 0xc0, 0xf0, 0x2d, 0xd6, 0xf0);
109 DEFINE_GUID(EAX_VOCALMORPHER_EFFECT
, 0xe41cf10c, 0x3383, 0x11d2, 0x88, 0xdd, 0x00, 0xa0, 0x24, 0xd1, 0x3c, 0xe1);
110 DEFINE_GUID(EAX_PITCHSHIFTER_EFFECT
, 0xe7905100, 0xafb2, 0x11d2, 0x88, 0xdd, 0x00, 0xa0, 0x24, 0xd1, 0x3c, 0xe1);
111 DEFINE_GUID(EAX_RINGMODULATOR_EFFECT
, 0x0b89fe60, 0xafb5, 0x11d2, 0x88, 0xdd, 0x00, 0xa0, 0x24, 0xd1, 0x3c, 0xe1);
115 EAXFXSLOT_UNLOCKED
= 0,
119 /* EAXFXSLOT_FLAGS */
120 #define EAXFXSLOTFLAGS_ENVIRONMENT 0x00000001
123 DEFINE_GUID(EAXPROPERTYID_EAX40_Source
, 0x1b86b823, 0x22df, 0x4eae, 0x8b, 0x3c, 0x12, 0x78, 0xce, 0x54, 0x42, 0x27);
126 EAXSOURCE_ALLPARAMETERS
,
127 EAXSOURCE_OBSTRUCTIONPARAMETERS
,
128 EAXSOURCE_OCCLUSIONPARAMETERS
,
129 EAXSOURCE_EXCLUSIONPARAMETERS
,
134 EAXSOURCE_OBSTRUCTION
,
135 EAXSOURCE_OBSTRUCTIONLFRATIO
,
137 EAXSOURCE_OCCLUSIONLFRATIO
,
138 EAXSOURCE_OCCLUSIONROOMRATIO
,
139 EAXSOURCE_OCCLUSIONDIRECTRATIO
,
141 EAXSOURCE_EXCLUSIONLFRATIO
,
142 EAXSOURCE_OUTSIDEVOLUMEHF
,
143 EAXSOURCE_DOPPLERFACTOR
,
144 EAXSOURCE_ROLLOFFFACTOR
,
145 EAXSOURCE_ROOMROLLOFFFACTOR
,
146 EAXSOURCE_AIRABSORPTIONFACTOR
,
148 EAXSOURCE_SENDPARAMETERS
,
149 EAXSOURCE_ALLSENDPARAMETERS
,
150 EAXSOURCE_OCCLUSIONSENDPARAMETERS
,
151 EAXSOURCE_EXCLUSIONSENDPARAMETERS
,
152 EAXSOURCE_ACTIVEFXSLOTID
,
153 } EAXSOURCE_PROPERTY
;
155 #define EAXSOURCE_PARAMETER_IMMEDIATE 0x00000000
156 #define EAXSOURCE_PARAMETER_DEFERRED 0x80000000
157 #define EAXSOURCE_PARAMETER_COMMITDEFERREDSETTINGS (EAXSOURCE_NONE | EAXSOURCE_PARAMETER_IMMEDIATE)
159 /* EAXSOURCE_ALLPARAMETERS */
160 typedef struct _EAXSOURCEPROPERTIES
{
163 /* TODO: Do these act as offets for individual sends? Or overwrite them all
164 * when set? Or only apply to sends using the context's primary FXSlot?
169 float flObstructionLFRatio
;
171 float flOcclusionLFRatio
;
172 float flOcclusionRoomRatio
;
173 float flOcclusionDirectRatio
;
175 float flExclusionLFRatio
;
176 long lOutsideVolumeHF
;
177 float flDopplerFactor
;
178 /* NOTE: Added, not multiplied, with the listener's value. */
179 float flRolloffFactor
;
180 float flRoomRolloffFactor
;
181 float flAirAbsorptionFactor
;
183 } EAXSOURCEPROPERTIES
, *LPEAXSOURCEPROPERTIES
;
185 /* EAXSOURCE_OBSTRUCTIONPARAMETERS */
186 #ifndef EAX_OBSTRUCTIONPROPERTIES_DEFINED
187 #define EAX_OBSTRUCTIONPROPERTIES_DEFINED
188 typedef struct _EAXOBSTRUCTIONPROPERTIES
{
190 float flObstructionLFRatio
;
191 } EAXOBSTRUCTIONPROPERTIES
, *LPEAXOBSTRUCTIONPROPERTIES
;
194 /* EAXSOURCE_OCCLUSIONPARAMETERS */
195 #ifndef EAX_OCCLUSIONPROPERTIES_DEFINED
196 #define EAX_OCCLUSIONPROPERTIES_DEFINED
197 typedef struct _EAXOCCLUSIONPROPERTIES
{
199 float flOcclusionLFRatio
;
200 float flOcclusionRoomRatio
;
201 float flOcclusionDirectRatio
;
202 } EAXOCCLUSIONPROPERTIES
, *LPEAXOCCLUSIONPROPERTIES
;
205 /* EAXSOURCE_EXCLUSIONPARAMETERS */
206 #ifndef EAX_EXCLUSIONPROPERTIES_DEFINED
207 #define EAX_EXCLUSIONPROPERTIES_DEFINED
208 typedef struct _EAXEXCLUSIONPROPERTIES
{
210 float flExclusionLFRatio
;
211 } EAXEXCLUSIONPROPERTIES
, *LPEAXEXCLUSIONPROPERTIES
;
214 /* EAXSOURCE_FLAGS */
215 #define EAXSOURCEFLAGS_DIRECTHFAUTO 0x00000001
216 #define EAXSOURCEFLAGS_ROOMAUTO 0x00000002
217 #define EAXSOURCEFLAGS_ROOMHFAUTO 0x00000004
219 /* EAXSOURCE_SENDPARAMETERS */
220 typedef struct _EAXSOURCESENDPROPERTIES
{
221 /* TODO: Check if sources maintain send parameters for each potential
222 * effect slot, or if this needs to match a currently active effect slot to
223 * match a send (and gets reset when the active effect slot GUID changes).
224 * Also need to check how EAX_PrimaryFXSlotID is treated (as itself, or if
225 * it looks at the context's primary FXSlot).
227 GUID guidReceivingFXSlotID
;
230 } EAXSOURCESENDPROPERTIES
, *LPEAXSOURCESENDPROPERTIES
;
232 /* EAXSOURCE_ALLSENDPARAMETERS */
233 typedef struct _EAXSOURCEALLSENDPROPERTIES
{
234 GUID guidReceivingFXSlotID
;
238 float flOcclusionLFRatio
;
239 float flOcclusionRoomRatio
;
240 float flOcclusionDirectRatio
;
242 float flExclusionLFRatio
;
243 } EAXSOURCEALLSENDPROPERTIES
, *LPEAXSOURCEALLSENDPROPERTIES
;
245 /* EAXSOURCE_OCCLUSIONSENDPARAMETERS */
246 typedef struct _EAXSOURCEOCCLUSIONSENDPROPERTIES
{
247 GUID guidReceivingFXSlotID
;
249 float flOcclusionLFRatio
;
250 float flOcclusionRoomRatio
;
251 float flOcclusionDirectRatio
;
252 } EAXSOURCEOCCLUSIONSENDPROPERTIES
, *LPEAXSOURCEOCCLUSIONSENDPROPERTIES
;
254 /* EAXSOURCE_EXCLUSIONSENDPARAMETERS */
255 typedef struct _EAXSOURCEEXCLUSIONSENDPROPERTIES
{
256 GUID guidReceivingFXSlotID
;
258 float flExclusionLFRatio
;
259 } EAXSOURCEEXCLUSIONSENDPROPERTIES
, *LPEAXSOURCEEXCLUSIONSENDPROPERTIES
;
261 /* EAXSOURCE_ACTIVEFXSLOTID */
262 typedef struct _EAXACTIVEFXSLOTS
{
263 GUID guidActiveFXSlots
[EAX_MAX_ACTIVE_FXSLOTS
];
264 } EAXACTIVEFXSLOTS
, *LPEAXACTIVEFXSLOTS
;
266 DEFINE_GUID(EAX_PrimaryFXSlotID
, 0xf317866d, 0x924c, 0x450c, 0x86, 0x1b, 0xe6, 0xda, 0xa2, 0x5e, 0x7c, 0x20);
269 /* EAX_REVERB_EFFECT properties. */
272 EAXREVERB_ALLPARAMETERS
,
273 EAXREVERB_ENVIRONMENT
,
274 EAXREVERB_ENVIRONMENTSIZE
,
275 EAXREVERB_ENVIRONMENTDIFFUSION
,
280 EAXREVERB_DECAYHFRATIO
,
281 EAXREVERB_DECAYLFRATIO
,
282 EAXREVERB_REFLECTIONS
,
283 EAXREVERB_REFLECTIONSDELAY
,
284 EAXREVERB_REFLECTIONSPAN
,
286 EAXREVERB_REVERBDELAY
,
290 EAXREVERB_MODULATIONTIME
,
291 EAXREVERB_MODULATIONDEPTH
,
292 EAXREVERB_AIRABSORPTIONHF
,
293 EAXREVERB_HFREFERENCE
,
294 EAXREVERB_LFREFERENCE
,
295 EAXREVERB_ROOMROLLOFFFACTOR
,
297 } EAXREVERB_PROPERTY
;
299 #define EAXREVERB_IMMEDIATE 0x00000000
300 #define EAXREVERB_DEFERRED 0x80000000
301 #define EAXREVERB_COMMITDEFERREDSETTINGS (EAXREVERB_NONE | EAXREVERB_IMMEDIATE)
303 /* EAXREVERB_ALLPARAMETERS */
304 typedef struct _EAXREVERBPROPERTIES
{
306 float flEnvironmentSize
;
307 float flEnvironmentDiffusion
;
312 float flDecayHFRatio
;
313 float flDecayLFRatio
;
315 float flReflectionsDelay
;
316 EAXVECTOR vReflectionsPan
;
319 EAXVECTOR vReverbPan
;
322 float flModulationTime
;
323 float flModulationDepth
;
324 float flAirAbsorptionHF
;
327 float flRoomRolloffFactor
;
329 } EAXREVERBPROPERTIES
, *LPEAXREVERBPROPERTIES
;
331 /* EAXREVERB_ENVIRONMENT */
332 #ifndef EAX_ENVIRONMENTS_DEFINED
333 #define EAX_ENVIRONMENTS_DEFINED
335 EAX_ENVIRONMENT_GENERIC
,
336 EAX_ENVIRONMENT_PADDEDCELL
,
337 EAX_ENVIRONMENT_ROOM
,
338 EAX_ENVIRONMENT_BATHROOM
,
339 EAX_ENVIRONMENT_LIVINGROOM
,
340 EAX_ENVIRONMENT_STONEROOM
,
341 EAX_ENVIRONMENT_AUDITORIUM
,
342 EAX_ENVIRONMENT_CONCERTHALL
,
343 EAX_ENVIRONMENT_CAVE
,
344 EAX_ENVIRONMENT_ARENA
,
345 EAX_ENVIRONMENT_HANGAR
,
346 EAX_ENVIRONMENT_CARPETEDHALLWAY
,
347 EAX_ENVIRONMENT_HALLWAY
,
348 EAX_ENVIRONMENT_STONECORRIDOR
,
349 EAX_ENVIRONMENT_ALLEY
,
350 EAX_ENVIRONMENT_FOREST
,
351 EAX_ENVIRONMENT_CITY
,
352 EAX_ENVIRONMENT_MOUNTAINS
,
353 EAX_ENVIRONMENT_QUARRY
,
354 EAX_ENVIRONMENT_PLAIN
,
355 EAX_ENVIRONMENT_PARKINGLOT
,
356 EAX_ENVIRONMENT_SEWERPIPE
,
357 EAX_ENVIRONMENT_UNDERWATER
,
358 EAX_ENVIRONMENT_DRUGGED
,
359 EAX_ENVIRONMENT_DIZZY
,
360 EAX_ENVIRONMENT_PSYCHOTIC
,
362 EAX_ENVIRONMENT_UNDEFINED
,
364 EAX_ENVIRONMENT_COUNT
368 /* EAXREVERB_FLAGS */
369 /* These flags determine what properties are modified when the environment size
372 #define EAXREVERBFLAGS_DECAYTIMESCALE 0x00000001
373 #define EAXREVERBFLAGS_REFLECTIONSSCALE 0x00000002
374 #define EAXREVERBFLAGS_REFLECTIONSDELAYSCALE 0x00000004
375 #define EAXREVERBFLAGS_REVERBSCALE 0x00000008
376 #define EAXREVERBFLAGS_REVERBDELAYSCALE 0x00000010
377 #define EAXREVERBFLAGS_ECHOTIMESCALE 0x00000040
378 #define EAXREVERBFLAGS_MODULATIONTIMESCALE 0x00000080
379 /* This flag limits the high frequency decay according to air absorption */
380 #define EAXREVERBFLAGS_DECAYHFLIMIT 0x00000020
383 /* TODO: Other effects. */