Check for a minimum PipeWire version
[openal-soft.git] / al / effects / reverb.cpp
blob197ea50048b491b90ae8598540a25308a925baf3
2 #include "config.h"
4 #include <cmath>
6 #include "AL/al.h"
7 #include "AL/efx.h"
9 #include "alc/effects/base.h"
10 #include "effects.h"
12 #ifdef ALSOFT_EAX
13 #include <tuple>
14 #include "alnumeric.h"
15 #include "AL/efx-presets.h"
16 #include "al/eax_exception.h"
17 #include "al/eax_utils.h"
18 #endif // ALSOFT_EAX
21 namespace {
23 void Reverb_setParami(EffectProps *props, ALenum param, int val)
25 switch(param)
27 case AL_EAXREVERB_DECAY_HFLIMIT:
28 if(!(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT))
29 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hflimit out of range"};
30 props->Reverb.DecayHFLimit = val != AL_FALSE;
31 break;
33 default:
34 throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
35 param};
38 void Reverb_setParamiv(EffectProps *props, ALenum param, const int *vals)
39 { Reverb_setParami(props, param, vals[0]); }
40 void Reverb_setParamf(EffectProps *props, ALenum param, float val)
42 switch(param)
44 case AL_EAXREVERB_DENSITY:
45 if(!(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY))
46 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb density out of range"};
47 props->Reverb.Density = val;
48 break;
50 case AL_EAXREVERB_DIFFUSION:
51 if(!(val >= AL_EAXREVERB_MIN_DIFFUSION && val <= AL_EAXREVERB_MAX_DIFFUSION))
52 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb diffusion out of range"};
53 props->Reverb.Diffusion = val;
54 break;
56 case AL_EAXREVERB_GAIN:
57 if(!(val >= AL_EAXREVERB_MIN_GAIN && val <= AL_EAXREVERB_MAX_GAIN))
58 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gain out of range"};
59 props->Reverb.Gain = val;
60 break;
62 case AL_EAXREVERB_GAINHF:
63 if(!(val >= AL_EAXREVERB_MIN_GAINHF && val <= AL_EAXREVERB_MAX_GAINHF))
64 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gainhf out of range"};
65 props->Reverb.GainHF = val;
66 break;
68 case AL_EAXREVERB_GAINLF:
69 if(!(val >= AL_EAXREVERB_MIN_GAINLF && val <= AL_EAXREVERB_MAX_GAINLF))
70 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gainlf out of range"};
71 props->Reverb.GainLF = val;
72 break;
74 case AL_EAXREVERB_DECAY_TIME:
75 if(!(val >= AL_EAXREVERB_MIN_DECAY_TIME && val <= AL_EAXREVERB_MAX_DECAY_TIME))
76 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay time out of range"};
77 props->Reverb.DecayTime = val;
78 break;
80 case AL_EAXREVERB_DECAY_HFRATIO:
81 if(!(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO && val <= AL_EAXREVERB_MAX_DECAY_HFRATIO))
82 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hfratio out of range"};
83 props->Reverb.DecayHFRatio = val;
84 break;
86 case AL_EAXREVERB_DECAY_LFRATIO:
87 if(!(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO && val <= AL_EAXREVERB_MAX_DECAY_LFRATIO))
88 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay lfratio out of range"};
89 props->Reverb.DecayLFRatio = val;
90 break;
92 case AL_EAXREVERB_REFLECTIONS_GAIN:
93 if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN))
94 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections gain out of range"};
95 props->Reverb.ReflectionsGain = val;
96 break;
98 case AL_EAXREVERB_REFLECTIONS_DELAY:
99 if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY))
100 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections delay out of range"};
101 props->Reverb.ReflectionsDelay = val;
102 break;
104 case AL_EAXREVERB_LATE_REVERB_GAIN:
105 if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN))
106 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb gain out of range"};
107 props->Reverb.LateReverbGain = val;
108 break;
110 case AL_EAXREVERB_LATE_REVERB_DELAY:
111 if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY))
112 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb delay out of range"};
113 props->Reverb.LateReverbDelay = val;
114 break;
116 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
117 if(!(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF))
118 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb air absorption gainhf out of range"};
119 props->Reverb.AirAbsorptionGainHF = val;
120 break;
122 case AL_EAXREVERB_ECHO_TIME:
123 if(!(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME))
124 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb echo time out of range"};
125 props->Reverb.EchoTime = val;
126 break;
128 case AL_EAXREVERB_ECHO_DEPTH:
129 if(!(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH))
130 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb echo depth out of range"};
131 props->Reverb.EchoDepth = val;
132 break;
134 case AL_EAXREVERB_MODULATION_TIME:
135 if(!(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME))
136 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb modulation time out of range"};
137 props->Reverb.ModulationTime = val;
138 break;
140 case AL_EAXREVERB_MODULATION_DEPTH:
141 if(!(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH))
142 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb modulation depth out of range"};
143 props->Reverb.ModulationDepth = val;
144 break;
146 case AL_EAXREVERB_HFREFERENCE:
147 if(!(val >= AL_EAXREVERB_MIN_HFREFERENCE && val <= AL_EAXREVERB_MAX_HFREFERENCE))
148 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb hfreference out of range"};
149 props->Reverb.HFReference = val;
150 break;
152 case AL_EAXREVERB_LFREFERENCE:
153 if(!(val >= AL_EAXREVERB_MIN_LFREFERENCE && val <= AL_EAXREVERB_MAX_LFREFERENCE))
154 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb lfreference out of range"};
155 props->Reverb.LFReference = val;
156 break;
158 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
159 if(!(val >= AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR))
160 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb room rolloff factor out of range"};
161 props->Reverb.RoomRolloffFactor = val;
162 break;
164 default:
165 throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
168 void Reverb_setParamfv(EffectProps *props, ALenum param, const float *vals)
170 switch(param)
172 case AL_EAXREVERB_REFLECTIONS_PAN:
173 if(!(std::isfinite(vals[0]) && std::isfinite(vals[1]) && std::isfinite(vals[2])))
174 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections pan out of range"};
175 props->Reverb.ReflectionsPan[0] = vals[0];
176 props->Reverb.ReflectionsPan[1] = vals[1];
177 props->Reverb.ReflectionsPan[2] = vals[2];
178 break;
179 case AL_EAXREVERB_LATE_REVERB_PAN:
180 if(!(std::isfinite(vals[0]) && std::isfinite(vals[1]) && std::isfinite(vals[2])))
181 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb pan out of range"};
182 props->Reverb.LateReverbPan[0] = vals[0];
183 props->Reverb.LateReverbPan[1] = vals[1];
184 props->Reverb.LateReverbPan[2] = vals[2];
185 break;
187 default:
188 Reverb_setParamf(props, param, vals[0]);
189 break;
193 void Reverb_getParami(const EffectProps *props, ALenum param, int *val)
195 switch(param)
197 case AL_EAXREVERB_DECAY_HFLIMIT:
198 *val = props->Reverb.DecayHFLimit;
199 break;
201 default:
202 throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
203 param};
206 void Reverb_getParamiv(const EffectProps *props, ALenum param, int *vals)
207 { Reverb_getParami(props, param, vals); }
208 void Reverb_getParamf(const EffectProps *props, ALenum param, float *val)
210 switch(param)
212 case AL_EAXREVERB_DENSITY:
213 *val = props->Reverb.Density;
214 break;
216 case AL_EAXREVERB_DIFFUSION:
217 *val = props->Reverb.Diffusion;
218 break;
220 case AL_EAXREVERB_GAIN:
221 *val = props->Reverb.Gain;
222 break;
224 case AL_EAXREVERB_GAINHF:
225 *val = props->Reverb.GainHF;
226 break;
228 case AL_EAXREVERB_GAINLF:
229 *val = props->Reverb.GainLF;
230 break;
232 case AL_EAXREVERB_DECAY_TIME:
233 *val = props->Reverb.DecayTime;
234 break;
236 case AL_EAXREVERB_DECAY_HFRATIO:
237 *val = props->Reverb.DecayHFRatio;
238 break;
240 case AL_EAXREVERB_DECAY_LFRATIO:
241 *val = props->Reverb.DecayLFRatio;
242 break;
244 case AL_EAXREVERB_REFLECTIONS_GAIN:
245 *val = props->Reverb.ReflectionsGain;
246 break;
248 case AL_EAXREVERB_REFLECTIONS_DELAY:
249 *val = props->Reverb.ReflectionsDelay;
250 break;
252 case AL_EAXREVERB_LATE_REVERB_GAIN:
253 *val = props->Reverb.LateReverbGain;
254 break;
256 case AL_EAXREVERB_LATE_REVERB_DELAY:
257 *val = props->Reverb.LateReverbDelay;
258 break;
260 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
261 *val = props->Reverb.AirAbsorptionGainHF;
262 break;
264 case AL_EAXREVERB_ECHO_TIME:
265 *val = props->Reverb.EchoTime;
266 break;
268 case AL_EAXREVERB_ECHO_DEPTH:
269 *val = props->Reverb.EchoDepth;
270 break;
272 case AL_EAXREVERB_MODULATION_TIME:
273 *val = props->Reverb.ModulationTime;
274 break;
276 case AL_EAXREVERB_MODULATION_DEPTH:
277 *val = props->Reverb.ModulationDepth;
278 break;
280 case AL_EAXREVERB_HFREFERENCE:
281 *val = props->Reverb.HFReference;
282 break;
284 case AL_EAXREVERB_LFREFERENCE:
285 *val = props->Reverb.LFReference;
286 break;
288 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
289 *val = props->Reverb.RoomRolloffFactor;
290 break;
292 default:
293 throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
296 void Reverb_getParamfv(const EffectProps *props, ALenum param, float *vals)
298 switch(param)
300 case AL_EAXREVERB_REFLECTIONS_PAN:
301 vals[0] = props->Reverb.ReflectionsPan[0];
302 vals[1] = props->Reverb.ReflectionsPan[1];
303 vals[2] = props->Reverb.ReflectionsPan[2];
304 break;
305 case AL_EAXREVERB_LATE_REVERB_PAN:
306 vals[0] = props->Reverb.LateReverbPan[0];
307 vals[1] = props->Reverb.LateReverbPan[1];
308 vals[2] = props->Reverb.LateReverbPan[2];
309 break;
311 default:
312 Reverb_getParamf(props, param, vals);
313 break;
317 EffectProps genDefaultProps() noexcept
319 EffectProps props{};
320 props.Reverb.Density = AL_EAXREVERB_DEFAULT_DENSITY;
321 props.Reverb.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION;
322 props.Reverb.Gain = AL_EAXREVERB_DEFAULT_GAIN;
323 props.Reverb.GainHF = AL_EAXREVERB_DEFAULT_GAINHF;
324 props.Reverb.GainLF = AL_EAXREVERB_DEFAULT_GAINLF;
325 props.Reverb.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME;
326 props.Reverb.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO;
327 props.Reverb.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO;
328 props.Reverb.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN;
329 props.Reverb.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY;
330 props.Reverb.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
331 props.Reverb.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
332 props.Reverb.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
333 props.Reverb.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN;
334 props.Reverb.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY;
335 props.Reverb.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
336 props.Reverb.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
337 props.Reverb.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
338 props.Reverb.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME;
339 props.Reverb.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH;
340 props.Reverb.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME;
341 props.Reverb.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH;
342 props.Reverb.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
343 props.Reverb.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE;
344 props.Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE;
345 props.Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
346 props.Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT;
347 return props;
351 void StdReverb_setParami(EffectProps *props, ALenum param, int val)
353 switch(param)
355 case AL_REVERB_DECAY_HFLIMIT:
356 if(!(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT))
357 throw effect_exception{AL_INVALID_VALUE, "Reverb decay hflimit out of range"};
358 props->Reverb.DecayHFLimit = val != AL_FALSE;
359 break;
361 default:
362 throw effect_exception{AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param};
365 void StdReverb_setParamiv(EffectProps *props, ALenum param, const int *vals)
366 { StdReverb_setParami(props, param, vals[0]); }
367 void StdReverb_setParamf(EffectProps *props, ALenum param, float val)
369 switch(param)
371 case AL_REVERB_DENSITY:
372 if(!(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY))
373 throw effect_exception{AL_INVALID_VALUE, "Reverb density out of range"};
374 props->Reverb.Density = val;
375 break;
377 case AL_REVERB_DIFFUSION:
378 if(!(val >= AL_REVERB_MIN_DIFFUSION && val <= AL_REVERB_MAX_DIFFUSION))
379 throw effect_exception{AL_INVALID_VALUE, "Reverb diffusion out of range"};
380 props->Reverb.Diffusion = val;
381 break;
383 case AL_REVERB_GAIN:
384 if(!(val >= AL_REVERB_MIN_GAIN && val <= AL_REVERB_MAX_GAIN))
385 throw effect_exception{AL_INVALID_VALUE, "Reverb gain out of range"};
386 props->Reverb.Gain = val;
387 break;
389 case AL_REVERB_GAINHF:
390 if(!(val >= AL_REVERB_MIN_GAINHF && val <= AL_REVERB_MAX_GAINHF))
391 throw effect_exception{AL_INVALID_VALUE, "Reverb gainhf out of range"};
392 props->Reverb.GainHF = val;
393 break;
395 case AL_REVERB_DECAY_TIME:
396 if(!(val >= AL_REVERB_MIN_DECAY_TIME && val <= AL_REVERB_MAX_DECAY_TIME))
397 throw effect_exception{AL_INVALID_VALUE, "Reverb decay time out of range"};
398 props->Reverb.DecayTime = val;
399 break;
401 case AL_REVERB_DECAY_HFRATIO:
402 if(!(val >= AL_REVERB_MIN_DECAY_HFRATIO && val <= AL_REVERB_MAX_DECAY_HFRATIO))
403 throw effect_exception{AL_INVALID_VALUE, "Reverb decay hfratio out of range"};
404 props->Reverb.DecayHFRatio = val;
405 break;
407 case AL_REVERB_REFLECTIONS_GAIN:
408 if(!(val >= AL_REVERB_MIN_REFLECTIONS_GAIN && val <= AL_REVERB_MAX_REFLECTIONS_GAIN))
409 throw effect_exception{AL_INVALID_VALUE, "Reverb reflections gain out of range"};
410 props->Reverb.ReflectionsGain = val;
411 break;
413 case AL_REVERB_REFLECTIONS_DELAY:
414 if(!(val >= AL_REVERB_MIN_REFLECTIONS_DELAY && val <= AL_REVERB_MAX_REFLECTIONS_DELAY))
415 throw effect_exception{AL_INVALID_VALUE, "Reverb reflections delay out of range"};
416 props->Reverb.ReflectionsDelay = val;
417 break;
419 case AL_REVERB_LATE_REVERB_GAIN:
420 if(!(val >= AL_REVERB_MIN_LATE_REVERB_GAIN && val <= AL_REVERB_MAX_LATE_REVERB_GAIN))
421 throw effect_exception{AL_INVALID_VALUE, "Reverb late reverb gain out of range"};
422 props->Reverb.LateReverbGain = val;
423 break;
425 case AL_REVERB_LATE_REVERB_DELAY:
426 if(!(val >= AL_REVERB_MIN_LATE_REVERB_DELAY && val <= AL_REVERB_MAX_LATE_REVERB_DELAY))
427 throw effect_exception{AL_INVALID_VALUE, "Reverb late reverb delay out of range"};
428 props->Reverb.LateReverbDelay = val;
429 break;
431 case AL_REVERB_AIR_ABSORPTION_GAINHF:
432 if(!(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF))
433 throw effect_exception{AL_INVALID_VALUE, "Reverb air absorption gainhf out of range"};
434 props->Reverb.AirAbsorptionGainHF = val;
435 break;
437 case AL_REVERB_ROOM_ROLLOFF_FACTOR:
438 if(!(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR))
439 throw effect_exception{AL_INVALID_VALUE, "Reverb room rolloff factor out of range"};
440 props->Reverb.RoomRolloffFactor = val;
441 break;
443 default:
444 throw effect_exception{AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param};
447 void StdReverb_setParamfv(EffectProps *props, ALenum param, const float *vals)
448 { StdReverb_setParamf(props, param, vals[0]); }
450 void StdReverb_getParami(const EffectProps *props, ALenum param, int *val)
452 switch(param)
454 case AL_REVERB_DECAY_HFLIMIT:
455 *val = props->Reverb.DecayHFLimit;
456 break;
458 default:
459 throw effect_exception{AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param};
462 void StdReverb_getParamiv(const EffectProps *props, ALenum param, int *vals)
463 { StdReverb_getParami(props, param, vals); }
464 void StdReverb_getParamf(const EffectProps *props, ALenum param, float *val)
466 switch(param)
468 case AL_REVERB_DENSITY:
469 *val = props->Reverb.Density;
470 break;
472 case AL_REVERB_DIFFUSION:
473 *val = props->Reverb.Diffusion;
474 break;
476 case AL_REVERB_GAIN:
477 *val = props->Reverb.Gain;
478 break;
480 case AL_REVERB_GAINHF:
481 *val = props->Reverb.GainHF;
482 break;
484 case AL_REVERB_DECAY_TIME:
485 *val = props->Reverb.DecayTime;
486 break;
488 case AL_REVERB_DECAY_HFRATIO:
489 *val = props->Reverb.DecayHFRatio;
490 break;
492 case AL_REVERB_REFLECTIONS_GAIN:
493 *val = props->Reverb.ReflectionsGain;
494 break;
496 case AL_REVERB_REFLECTIONS_DELAY:
497 *val = props->Reverb.ReflectionsDelay;
498 break;
500 case AL_REVERB_LATE_REVERB_GAIN:
501 *val = props->Reverb.LateReverbGain;
502 break;
504 case AL_REVERB_LATE_REVERB_DELAY:
505 *val = props->Reverb.LateReverbDelay;
506 break;
508 case AL_REVERB_AIR_ABSORPTION_GAINHF:
509 *val = props->Reverb.AirAbsorptionGainHF;
510 break;
512 case AL_REVERB_ROOM_ROLLOFF_FACTOR:
513 *val = props->Reverb.RoomRolloffFactor;
514 break;
516 default:
517 throw effect_exception{AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param};
520 void StdReverb_getParamfv(const EffectProps *props, ALenum param, float *vals)
521 { StdReverb_getParamf(props, param, vals); }
523 EffectProps genDefaultStdProps() noexcept
525 EffectProps props{};
526 props.Reverb.Density = AL_REVERB_DEFAULT_DENSITY;
527 props.Reverb.Diffusion = AL_REVERB_DEFAULT_DIFFUSION;
528 props.Reverb.Gain = AL_REVERB_DEFAULT_GAIN;
529 props.Reverb.GainHF = AL_REVERB_DEFAULT_GAINHF;
530 props.Reverb.GainLF = 1.0f;
531 props.Reverb.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME;
532 props.Reverb.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO;
533 props.Reverb.DecayLFRatio = 1.0f;
534 props.Reverb.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN;
535 props.Reverb.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY;
536 props.Reverb.ReflectionsPan[0] = 0.0f;
537 props.Reverb.ReflectionsPan[1] = 0.0f;
538 props.Reverb.ReflectionsPan[2] = 0.0f;
539 props.Reverb.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN;
540 props.Reverb.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY;
541 props.Reverb.LateReverbPan[0] = 0.0f;
542 props.Reverb.LateReverbPan[1] = 0.0f;
543 props.Reverb.LateReverbPan[2] = 0.0f;
544 props.Reverb.EchoTime = 0.25f;
545 props.Reverb.EchoDepth = 0.0f;
546 props.Reverb.ModulationTime = 0.25f;
547 props.Reverb.ModulationDepth = 0.0f;
548 props.Reverb.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
549 props.Reverb.HFReference = 5000.0f;
550 props.Reverb.LFReference = 250.0f;
551 props.Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
552 props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT;
553 return props;
556 } // namespace
558 DEFINE_ALEFFECT_VTABLE(Reverb);
560 const EffectProps ReverbEffectProps{genDefaultProps()};
562 DEFINE_ALEFFECT_VTABLE(StdReverb);
564 const EffectProps StdReverbEffectProps{genDefaultStdProps()};
566 #ifdef ALSOFT_EAX
567 namespace {
569 extern const EFXEAXREVERBPROPERTIES eax_efx_reverb_presets[];
571 using EaxReverbEffectDirtyFlagsValue = std::uint_least32_t;
573 struct EaxReverbEffectDirtyFlags
575 using EaxIsBitFieldStruct = bool;
577 EaxReverbEffectDirtyFlagsValue ulEnvironment : 1;
578 EaxReverbEffectDirtyFlagsValue flEnvironmentSize : 1;
579 EaxReverbEffectDirtyFlagsValue flEnvironmentDiffusion : 1;
580 EaxReverbEffectDirtyFlagsValue lRoom : 1;
581 EaxReverbEffectDirtyFlagsValue lRoomHF : 1;
582 EaxReverbEffectDirtyFlagsValue lRoomLF : 1;
583 EaxReverbEffectDirtyFlagsValue flDecayTime : 1;
584 EaxReverbEffectDirtyFlagsValue flDecayHFRatio : 1;
585 EaxReverbEffectDirtyFlagsValue flDecayLFRatio : 1;
586 EaxReverbEffectDirtyFlagsValue lReflections : 1;
587 EaxReverbEffectDirtyFlagsValue flReflectionsDelay : 1;
588 EaxReverbEffectDirtyFlagsValue vReflectionsPan : 1;
589 EaxReverbEffectDirtyFlagsValue lReverb : 1;
590 EaxReverbEffectDirtyFlagsValue flReverbDelay : 1;
591 EaxReverbEffectDirtyFlagsValue vReverbPan : 1;
592 EaxReverbEffectDirtyFlagsValue flEchoTime : 1;
593 EaxReverbEffectDirtyFlagsValue flEchoDepth : 1;
594 EaxReverbEffectDirtyFlagsValue flModulationTime : 1;
595 EaxReverbEffectDirtyFlagsValue flModulationDepth : 1;
596 EaxReverbEffectDirtyFlagsValue flAirAbsorptionHF : 1;
597 EaxReverbEffectDirtyFlagsValue flHFReference : 1;
598 EaxReverbEffectDirtyFlagsValue flLFReference : 1;
599 EaxReverbEffectDirtyFlagsValue flRoomRolloffFactor : 1;
600 EaxReverbEffectDirtyFlagsValue ulFlags : 1;
601 }; // EaxReverbEffectDirtyFlags
603 struct Eax1ReverbEffectDirtyFlags
605 using EaxIsBitFieldStruct = bool;
607 EaxReverbEffectDirtyFlagsValue ulEnvironment : 1;
608 EaxReverbEffectDirtyFlagsValue flVolume : 1;
609 EaxReverbEffectDirtyFlagsValue flDecayTime : 1;
610 EaxReverbEffectDirtyFlagsValue flDamping : 1;
611 }; // Eax1ReverbEffectDirtyFlags
613 class EaxReverbEffect final :
614 public EaxEffect
616 public:
617 EaxReverbEffect();
619 void dispatch(const EaxEaxCall& eax_call) override;
621 // [[nodiscard]]
622 bool apply_deferred() override;
624 private:
625 EAX_REVERBPROPERTIES eax1_{};
626 EAX_REVERBPROPERTIES eax1_d_{};
627 Eax1ReverbEffectDirtyFlags eax1_dirty_flags_{};
628 EAXREVERBPROPERTIES eax_{};
629 EAXREVERBPROPERTIES eax_d_{};
630 EaxReverbEffectDirtyFlags eax_dirty_flags_{};
632 [[noreturn]] static void eax_fail(const char* message);
634 void set_eax_defaults();
636 void set_efx_density_from_environment_size();
637 void set_efx_diffusion();
638 void set_efx_gain();
639 void set_efx_gain_hf();
640 void set_efx_gain_lf();
641 void set_efx_decay_time();
642 void set_efx_decay_hf_ratio();
643 void set_efx_decay_lf_ratio();
644 void set_efx_reflections_gain();
645 void set_efx_reflections_delay();
646 void set_efx_reflections_pan();
647 void set_efx_late_reverb_gain();
648 void set_efx_late_reverb_delay();
649 void set_efx_late_reverb_pan();
650 void set_efx_echo_time();
651 void set_efx_echo_depth();
652 void set_efx_modulation_time();
653 void set_efx_modulation_depth();
654 void set_efx_air_absorption_gain_hf();
655 void set_efx_hf_reference();
656 void set_efx_lf_reference();
657 void set_efx_room_rolloff_factor();
658 void set_efx_flags();
659 void set_efx_defaults();
661 void v1_get(const EaxEaxCall& eax_call) const;
663 void get_all(const EaxEaxCall& eax_call) const;
665 void get(const EaxEaxCall& eax_call) const;
667 static void v1_validate_environment(unsigned long environment);
668 static void v1_validate_volume(float volume);
669 static void v1_validate_decay_time(float decay_time);
670 static void v1_validate_damping(float damping);
671 static void v1_validate_all(const EAX_REVERBPROPERTIES& all);
673 void v1_defer_environment(unsigned long environment);
674 void v1_defer_volume(float volume);
675 void v1_defer_decay_time(float decay_time);
676 void v1_defer_damping(float damping);
677 void v1_defer_all(const EAX_REVERBPROPERTIES& all);
679 void v1_defer_environment(const EaxEaxCall& eax_call);
680 void v1_defer_volume(const EaxEaxCall& eax_call);
681 void v1_defer_decay_time(const EaxEaxCall& eax_call);
682 void v1_defer_damping(const EaxEaxCall& eax_call);
683 void v1_defer_all(const EaxEaxCall& eax_call);
684 void v1_defer(const EaxEaxCall& eax_call);
686 void v1_set_efx();
688 static void validate_environment(unsigned long ulEnvironment, int version, bool is_standalone);
689 static void validate_environment_size(float flEnvironmentSize);
690 static void validate_environment_diffusion(float flEnvironmentDiffusion);
691 static void validate_room(long lRoom);
692 static void validate_room_hf(long lRoomHF);
693 static void validate_room_lf(long lRoomLF);
694 static void validate_decay_time(float flDecayTime);
695 static void validate_decay_hf_ratio(float flDecayHFRatio);
696 static void validate_decay_lf_ratio(float flDecayLFRatio);
697 static void validate_reflections(long lReflections);
698 static void validate_reflections_delay(float flReflectionsDelay);
699 static void validate_reflections_pan(const EAXVECTOR& vReflectionsPan);
700 static void validate_reverb(long lReverb);
701 static void validate_reverb_delay(float flReverbDelay);
702 static void validate_reverb_pan(const EAXVECTOR& vReverbPan);
703 static void validate_echo_time(float flEchoTime);
704 static void validate_echo_depth(float flEchoDepth);
705 static void validate_modulation_time(float flModulationTime);
706 static void validate_modulation_depth(float flModulationDepth);
707 static void validate_air_absorbtion_hf(float air_absorbtion_hf);
708 static void validate_hf_reference(float flHFReference);
709 static void validate_lf_reference(float flLFReference);
710 static void validate_room_rolloff_factor(float flRoomRolloffFactor);
711 static void validate_flags(unsigned long ulFlags);
712 static void validate_all(const EAX20LISTENERPROPERTIES& all, int version);
713 static void validate_all(const EAXREVERBPROPERTIES& all, int version);
715 void defer_environment(unsigned long ulEnvironment);
716 void defer_environment_size(float flEnvironmentSize);
717 void defer_environment_diffusion(float flEnvironmentDiffusion);
718 void defer_room(long lRoom);
719 void defer_room_hf(long lRoomHF);
720 void defer_room_lf(long lRoomLF);
721 void defer_decay_time(float flDecayTime);
722 void defer_decay_hf_ratio(float flDecayHFRatio);
723 void defer_decay_lf_ratio(float flDecayLFRatio);
724 void defer_reflections(long lReflections);
725 void defer_reflections_delay(float flReflectionsDelay);
726 void defer_reflections_pan(const EAXVECTOR& vReflectionsPan);
727 void defer_reverb(long lReverb);
728 void defer_reverb_delay(float flReverbDelay);
729 void defer_reverb_pan(const EAXVECTOR& vReverbPan);
730 void defer_echo_time(float flEchoTime);
731 void defer_echo_depth(float flEchoDepth);
732 void defer_modulation_time(float flModulationTime);
733 void defer_modulation_depth(float flModulationDepth);
734 void defer_air_absorbtion_hf(float flAirAbsorptionHF);
735 void defer_hf_reference(float flHFReference);
736 void defer_lf_reference(float flLFReference);
737 void defer_room_rolloff_factor(float flRoomRolloffFactor);
738 void defer_flags(unsigned long ulFlags);
739 void defer_all(const EAX20LISTENERPROPERTIES& all);
740 void defer_all(const EAXREVERBPROPERTIES& all);
742 void defer_environment(const EaxEaxCall& eax_call);
743 void defer_environment_size(const EaxEaxCall& eax_call);
744 void defer_environment_diffusion(const EaxEaxCall& eax_call);
745 void defer_room(const EaxEaxCall& eax_call);
746 void defer_room_hf(const EaxEaxCall& eax_call);
747 void defer_room_lf(const EaxEaxCall& eax_call);
748 void defer_decay_time(const EaxEaxCall& eax_call);
749 void defer_decay_hf_ratio(const EaxEaxCall& eax_call);
750 void defer_decay_lf_ratio(const EaxEaxCall& eax_call);
751 void defer_reflections(const EaxEaxCall& eax_call);
752 void defer_reflections_delay(const EaxEaxCall& eax_call);
753 void defer_reflections_pan(const EaxEaxCall& eax_call);
754 void defer_reverb(const EaxEaxCall& eax_call);
755 void defer_reverb_delay(const EaxEaxCall& eax_call);
756 void defer_reverb_pan(const EaxEaxCall& eax_call);
757 void defer_echo_time(const EaxEaxCall& eax_call);
758 void defer_echo_depth(const EaxEaxCall& eax_call);
759 void defer_modulation_time(const EaxEaxCall& eax_call);
760 void defer_modulation_depth(const EaxEaxCall& eax_call);
761 void defer_air_absorbtion_hf(const EaxEaxCall& eax_call);
762 void defer_hf_reference(const EaxEaxCall& eax_call);
763 void defer_lf_reference(const EaxEaxCall& eax_call);
764 void defer_room_rolloff_factor(const EaxEaxCall& eax_call);
765 void defer_flags(const EaxEaxCall& eax_call);
766 void defer_all(const EaxEaxCall& eax_call);
768 void set(const EaxEaxCall& eax_call);
769 }; // EaxReverbEffect
772 class EaxReverbEffectException :
773 public EaxException
775 public:
776 explicit EaxReverbEffectException(
777 const char* message)
779 EaxException{"EAX_REVERB_EFFECT", message}
782 }; // EaxReverbEffectException
785 EaxReverbEffect::EaxReverbEffect()
786 : EaxEffect{AL_EFFECT_EAXREVERB}
788 set_eax_defaults();
789 set_efx_defaults();
792 void EaxReverbEffect::dispatch(const EaxEaxCall& eax_call)
794 eax_call.is_get() ? get(eax_call) : set(eax_call);
797 [[noreturn]] void EaxReverbEffect::eax_fail(const char* message)
799 throw EaxReverbEffectException{message};
802 void EaxReverbEffect::set_eax_defaults()
804 eax1_ = EAX1REVERB_PRESETS[EAX_ENVIRONMENT_GENERIC];
805 eax1_d_ = eax1_;
806 eax_ = EAXREVERB_PRESETS[EAX_ENVIRONMENT_GENERIC];
807 /* HACK: EAX2 has a default room volume of -10,000dB (silence), although
808 * newer versions use -1,000dB. What should be happening is properties for
809 * each EAX version is tracked separately, with the last version used for
810 * the properties to apply (presumably v2 or nothing being the default).
812 eax_.lRoom = EAXREVERB_MINROOM;
813 eax_d_ = eax_;
816 void EaxReverbEffect::set_efx_density_from_environment_size()
818 const auto eax_environment_size = eax_.flEnvironmentSize;
820 const auto efx_density = clamp(
821 (eax_environment_size * eax_environment_size * eax_environment_size) / 16.0F,
822 AL_EAXREVERB_MIN_DENSITY,
823 AL_EAXREVERB_MAX_DENSITY);
825 al_effect_props_.Reverb.Density = efx_density;
828 void EaxReverbEffect::set_efx_diffusion()
830 const auto efx_diffusion = clamp(
831 eax_.flEnvironmentDiffusion,
832 AL_EAXREVERB_MIN_DIFFUSION,
833 AL_EAXREVERB_MAX_DIFFUSION);
835 al_effect_props_.Reverb.Diffusion = efx_diffusion;
838 void EaxReverbEffect::set_efx_gain()
840 const auto efx_gain = clamp(
841 level_mb_to_gain(static_cast<float>(eax_.lRoom)),
842 AL_EAXREVERB_MIN_GAIN,
843 AL_EAXREVERB_MAX_GAIN);
845 al_effect_props_.Reverb.Gain = efx_gain;
848 void EaxReverbEffect::set_efx_gain_hf()
850 const auto efx_gain_hf = clamp(
851 level_mb_to_gain(static_cast<float>(eax_.lRoomHF)),
852 AL_EAXREVERB_MIN_GAINHF,
853 AL_EAXREVERB_MAX_GAINHF);
855 al_effect_props_.Reverb.GainHF = efx_gain_hf;
858 void EaxReverbEffect::set_efx_gain_lf()
860 const auto efx_gain_lf = clamp(
861 level_mb_to_gain(static_cast<float>(eax_.lRoomLF)),
862 AL_EAXREVERB_MIN_GAINLF,
863 AL_EAXREVERB_MAX_GAINLF);
865 al_effect_props_.Reverb.GainLF = efx_gain_lf;
868 void EaxReverbEffect::set_efx_decay_time()
870 const auto efx_decay_time = clamp(
871 eax_.flDecayTime,
872 AL_EAXREVERB_MIN_DECAY_TIME,
873 AL_EAXREVERB_MAX_DECAY_TIME);
875 al_effect_props_.Reverb.DecayTime = efx_decay_time;
878 void EaxReverbEffect::set_efx_decay_hf_ratio()
880 const auto efx_decay_hf_ratio = clamp(
881 eax_.flDecayHFRatio,
882 AL_EAXREVERB_MIN_DECAY_HFRATIO,
883 AL_EAXREVERB_MAX_DECAY_HFRATIO);
885 al_effect_props_.Reverb.DecayHFRatio = efx_decay_hf_ratio;
888 void EaxReverbEffect::set_efx_decay_lf_ratio()
890 const auto efx_decay_lf_ratio = clamp(
891 eax_.flDecayLFRatio,
892 AL_EAXREVERB_MIN_DECAY_LFRATIO,
893 AL_EAXREVERB_MAX_DECAY_LFRATIO);
895 al_effect_props_.Reverb.DecayLFRatio = efx_decay_lf_ratio;
898 void EaxReverbEffect::set_efx_reflections_gain()
900 const auto efx_reflections_gain = clamp(
901 level_mb_to_gain(static_cast<float>(eax_.lReflections)),
902 AL_EAXREVERB_MIN_REFLECTIONS_GAIN,
903 AL_EAXREVERB_MAX_REFLECTIONS_GAIN);
905 al_effect_props_.Reverb.ReflectionsGain = efx_reflections_gain;
908 void EaxReverbEffect::set_efx_reflections_delay()
910 const auto efx_reflections_delay = clamp(
911 eax_.flReflectionsDelay,
912 AL_EAXREVERB_MIN_REFLECTIONS_DELAY,
913 AL_EAXREVERB_MAX_REFLECTIONS_DELAY);
915 al_effect_props_.Reverb.ReflectionsDelay = efx_reflections_delay;
918 void EaxReverbEffect::set_efx_reflections_pan()
920 al_effect_props_.Reverb.ReflectionsPan[0] = eax_.vReflectionsPan.x;
921 al_effect_props_.Reverb.ReflectionsPan[1] = eax_.vReflectionsPan.y;
922 al_effect_props_.Reverb.ReflectionsPan[2] = eax_.vReflectionsPan.z;
925 void EaxReverbEffect::set_efx_late_reverb_gain()
927 const auto efx_late_reverb_gain = clamp(
928 level_mb_to_gain(static_cast<float>(eax_.lReverb)),
929 AL_EAXREVERB_MIN_LATE_REVERB_GAIN,
930 AL_EAXREVERB_MAX_LATE_REVERB_GAIN);
932 al_effect_props_.Reverb.LateReverbGain = efx_late_reverb_gain;
935 void EaxReverbEffect::set_efx_late_reverb_delay()
937 const auto efx_late_reverb_delay = clamp(
938 eax_.flReverbDelay,
939 AL_EAXREVERB_MIN_LATE_REVERB_DELAY,
940 AL_EAXREVERB_MAX_LATE_REVERB_DELAY);
942 al_effect_props_.Reverb.LateReverbDelay = efx_late_reverb_delay;
945 void EaxReverbEffect::set_efx_late_reverb_pan()
947 al_effect_props_.Reverb.LateReverbPan[0] = eax_.vReverbPan.x;
948 al_effect_props_.Reverb.LateReverbPan[1] = eax_.vReverbPan.y;
949 al_effect_props_.Reverb.LateReverbPan[2] = eax_.vReverbPan.z;
952 void EaxReverbEffect::set_efx_echo_time()
954 const auto efx_echo_time = clamp(
955 eax_.flEchoTime,
956 AL_EAXREVERB_MIN_ECHO_TIME,
957 AL_EAXREVERB_MAX_ECHO_TIME);
959 al_effect_props_.Reverb.EchoTime = efx_echo_time;
962 void EaxReverbEffect::set_efx_echo_depth()
964 const auto efx_echo_depth = clamp(
965 eax_.flEchoDepth,
966 AL_EAXREVERB_MIN_ECHO_DEPTH,
967 AL_EAXREVERB_MAX_ECHO_DEPTH);
969 al_effect_props_.Reverb.EchoDepth = efx_echo_depth;
972 void EaxReverbEffect::set_efx_modulation_time()
974 const auto efx_modulation_time = clamp(
975 eax_.flModulationTime,
976 AL_EAXREVERB_MIN_MODULATION_TIME,
977 AL_EAXREVERB_MAX_MODULATION_TIME);
979 al_effect_props_.Reverb.ModulationTime = efx_modulation_time;
982 void EaxReverbEffect::set_efx_modulation_depth()
984 const auto efx_modulation_depth = clamp(
985 eax_.flModulationDepth,
986 AL_EAXREVERB_MIN_MODULATION_DEPTH,
987 AL_EAXREVERB_MAX_MODULATION_DEPTH);
989 al_effect_props_.Reverb.ModulationDepth = efx_modulation_depth;
992 void EaxReverbEffect::set_efx_air_absorption_gain_hf()
994 const auto efx_air_absorption_hf = clamp(
995 level_mb_to_gain(eax_.flAirAbsorptionHF),
996 AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF,
997 AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF);
999 al_effect_props_.Reverb.AirAbsorptionGainHF = efx_air_absorption_hf;
1002 void EaxReverbEffect::set_efx_hf_reference()
1004 const auto efx_hf_reference = clamp(
1005 eax_.flHFReference,
1006 AL_EAXREVERB_MIN_HFREFERENCE,
1007 AL_EAXREVERB_MAX_HFREFERENCE);
1009 al_effect_props_.Reverb.HFReference = efx_hf_reference;
1012 void EaxReverbEffect::set_efx_lf_reference()
1014 const auto efx_lf_reference = clamp(
1015 eax_.flLFReference,
1016 AL_EAXREVERB_MIN_LFREFERENCE,
1017 AL_EAXREVERB_MAX_LFREFERENCE);
1019 al_effect_props_.Reverb.LFReference = efx_lf_reference;
1022 void EaxReverbEffect::set_efx_room_rolloff_factor()
1024 const auto efx_room_rolloff_factor = clamp(
1025 eax_.flRoomRolloffFactor,
1026 AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR,
1027 AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR);
1029 al_effect_props_.Reverb.RoomRolloffFactor = efx_room_rolloff_factor;
1032 void EaxReverbEffect::set_efx_flags()
1034 al_effect_props_.Reverb.DecayHFLimit = ((eax_.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0);
1037 void EaxReverbEffect::set_efx_defaults()
1039 set_efx_density_from_environment_size();
1040 set_efx_diffusion();
1041 set_efx_gain();
1042 set_efx_gain_hf();
1043 set_efx_gain_lf();
1044 set_efx_decay_time();
1045 set_efx_decay_hf_ratio();
1046 set_efx_decay_lf_ratio();
1047 set_efx_reflections_gain();
1048 set_efx_reflections_delay();
1049 set_efx_reflections_pan();
1050 set_efx_late_reverb_gain();
1051 set_efx_late_reverb_delay();
1052 set_efx_late_reverb_pan();
1053 set_efx_echo_time();
1054 set_efx_echo_depth();
1055 set_efx_modulation_time();
1056 set_efx_modulation_depth();
1057 set_efx_air_absorption_gain_hf();
1058 set_efx_hf_reference();
1059 set_efx_lf_reference();
1060 set_efx_room_rolloff_factor();
1061 set_efx_flags();
1064 void EaxReverbEffect::v1_get(const EaxEaxCall& eax_call) const
1066 switch(eax_call.get_property_id())
1068 case DSPROPERTY_EAX_ALL:
1069 eax_call.set_value<EaxReverbEffectException>(eax1_);
1070 break;
1072 case DSPROPERTY_EAX_ENVIRONMENT:
1073 eax_call.set_value<EaxReverbEffectException>(eax1_.environment);
1074 break;
1076 case DSPROPERTY_EAX_VOLUME:
1077 eax_call.set_value<EaxReverbEffectException>(eax1_.fVolume);
1078 break;
1080 case DSPROPERTY_EAX_DECAYTIME:
1081 eax_call.set_value<EaxReverbEffectException>(eax1_.fDecayTime_sec);
1082 break;
1084 case DSPROPERTY_EAX_DAMPING:
1085 eax_call.set_value<EaxReverbEffectException>(eax1_.fDamping);
1086 break;
1088 default:
1089 eax_fail("Unsupported property id.");
1093 void EaxReverbEffect::get_all(
1094 const EaxEaxCall& eax_call) const
1096 if (eax_call.get_version() == 2)
1098 auto& eax_reverb = eax_call.get_value<EaxReverbEffectException, EAX20LISTENERPROPERTIES>();
1099 eax_reverb.lRoom = eax_.lRoom;
1100 eax_reverb.lRoomHF = eax_.lRoomHF;
1101 eax_reverb.flRoomRolloffFactor = eax_.flRoomRolloffFactor;
1102 eax_reverb.flDecayTime = eax_.flDecayTime;
1103 eax_reverb.flDecayHFRatio = eax_.flDecayHFRatio;
1104 eax_reverb.lReflections = eax_.lReflections;
1105 eax_reverb.flReflectionsDelay = eax_.flReflectionsDelay;
1106 eax_reverb.lReverb = eax_.lReverb;
1107 eax_reverb.flReverbDelay = eax_.flReverbDelay;
1108 eax_reverb.dwEnvironment = eax_.ulEnvironment;
1109 eax_reverb.flEnvironmentSize = eax_.flEnvironmentSize;
1110 eax_reverb.flEnvironmentDiffusion = eax_.flEnvironmentDiffusion;
1111 eax_reverb.flAirAbsorptionHF = eax_.flAirAbsorptionHF;
1112 eax_reverb.dwFlags = eax_.ulFlags;
1114 else
1116 eax_call.set_value<EaxReverbEffectException>(eax_);
1120 void EaxReverbEffect::get(const EaxEaxCall& eax_call) const
1122 if(eax_call.get_version() == 1)
1123 v1_get(eax_call);
1124 else switch(eax_call.get_property_id())
1126 case EAXREVERB_NONE:
1127 break;
1129 case EAXREVERB_ALLPARAMETERS:
1130 get_all(eax_call);
1131 break;
1133 case EAXREVERB_ENVIRONMENT:
1134 eax_call.set_value<EaxReverbEffectException>(eax_.ulEnvironment);
1135 break;
1137 case EAXREVERB_ENVIRONMENTSIZE:
1138 eax_call.set_value<EaxReverbEffectException>(eax_.flEnvironmentSize);
1139 break;
1141 case EAXREVERB_ENVIRONMENTDIFFUSION:
1142 eax_call.set_value<EaxReverbEffectException>(eax_.flEnvironmentDiffusion);
1143 break;
1145 case EAXREVERB_ROOM:
1146 eax_call.set_value<EaxReverbEffectException>(eax_.lRoom);
1147 break;
1149 case EAXREVERB_ROOMHF:
1150 eax_call.set_value<EaxReverbEffectException>(eax_.lRoomHF);
1151 break;
1153 case EAXREVERB_ROOMLF:
1154 eax_call.set_value<EaxReverbEffectException>(eax_.lRoomLF);
1155 break;
1157 case EAXREVERB_DECAYTIME:
1158 eax_call.set_value<EaxReverbEffectException>(eax_.flDecayTime);
1159 break;
1161 case EAXREVERB_DECAYHFRATIO:
1162 eax_call.set_value<EaxReverbEffectException>(eax_.flDecayHFRatio);
1163 break;
1165 case EAXREVERB_DECAYLFRATIO:
1166 eax_call.set_value<EaxReverbEffectException>(eax_.flDecayLFRatio);
1167 break;
1169 case EAXREVERB_REFLECTIONS:
1170 eax_call.set_value<EaxReverbEffectException>(eax_.lReflections);
1171 break;
1173 case EAXREVERB_REFLECTIONSDELAY:
1174 eax_call.set_value<EaxReverbEffectException>(eax_.flReflectionsDelay);
1175 break;
1177 case EAXREVERB_REFLECTIONSPAN:
1178 eax_call.set_value<EaxReverbEffectException>(eax_.vReflectionsPan);
1179 break;
1181 case EAXREVERB_REVERB:
1182 eax_call.set_value<EaxReverbEffectException>(eax_.lReverb);
1183 break;
1185 case EAXREVERB_REVERBDELAY:
1186 eax_call.set_value<EaxReverbEffectException>(eax_.flReverbDelay);
1187 break;
1189 case EAXREVERB_REVERBPAN:
1190 eax_call.set_value<EaxReverbEffectException>(eax_.vReverbPan);
1191 break;
1193 case EAXREVERB_ECHOTIME:
1194 eax_call.set_value<EaxReverbEffectException>(eax_.flEchoTime);
1195 break;
1197 case EAXREVERB_ECHODEPTH:
1198 eax_call.set_value<EaxReverbEffectException>(eax_.flEchoDepth);
1199 break;
1201 case EAXREVERB_MODULATIONTIME:
1202 eax_call.set_value<EaxReverbEffectException>(eax_.flModulationTime);
1203 break;
1205 case EAXREVERB_MODULATIONDEPTH:
1206 eax_call.set_value<EaxReverbEffectException>(eax_.flModulationDepth);
1207 break;
1209 case EAXREVERB_AIRABSORPTIONHF:
1210 eax_call.set_value<EaxReverbEffectException>(eax_.flAirAbsorptionHF);
1211 break;
1213 case EAXREVERB_HFREFERENCE:
1214 eax_call.set_value<EaxReverbEffectException>(eax_.flHFReference);
1215 break;
1217 case EAXREVERB_LFREFERENCE:
1218 eax_call.set_value<EaxReverbEffectException>(eax_.flLFReference);
1219 break;
1221 case EAXREVERB_ROOMROLLOFFFACTOR:
1222 eax_call.set_value<EaxReverbEffectException>(eax_.flRoomRolloffFactor);
1223 break;
1225 case EAXREVERB_FLAGS:
1226 eax_call.set_value<EaxReverbEffectException>(eax_.ulFlags);
1227 break;
1229 default:
1230 eax_fail("Unsupported property id.");
1234 void EaxReverbEffect::v1_validate_environment(unsigned long environment)
1236 validate_environment(environment, 1, true);
1239 void EaxReverbEffect::v1_validate_volume(float volume)
1241 eax_validate_range<EaxReverbEffectException>("Volume", volume, EAX1REVERB_MINVOLUME, EAX1REVERB_MAXVOLUME);
1244 void EaxReverbEffect::v1_validate_decay_time(float decay_time)
1246 validate_decay_time(decay_time);
1249 void EaxReverbEffect::v1_validate_damping(float damping)
1251 eax_validate_range<EaxReverbEffectException>("Damping", damping, EAX1REVERB_MINDAMPING, EAX1REVERB_MAXDAMPING);
1254 void EaxReverbEffect::v1_validate_all(const EAX_REVERBPROPERTIES& all)
1256 v1_validate_environment(all.environment);
1257 v1_validate_volume(all.fVolume);
1258 v1_validate_decay_time(all.fDecayTime_sec);
1259 v1_validate_damping(all.fDamping);
1262 void EaxReverbEffect::validate_environment(
1263 unsigned long ulEnvironment,
1264 int version,
1265 bool is_standalone)
1267 eax_validate_range<EaxReverbEffectException>(
1268 "Environment",
1269 ulEnvironment,
1270 EAXREVERB_MINENVIRONMENT,
1271 (version <= 2 || is_standalone) ? EAX1REVERB_MAXENVIRONMENT : EAX30REVERB_MAXENVIRONMENT);
1274 void EaxReverbEffect::validate_environment_size(
1275 float flEnvironmentSize)
1277 eax_validate_range<EaxReverbEffectException>(
1278 "Environment Size",
1279 flEnvironmentSize,
1280 EAXREVERB_MINENVIRONMENTSIZE,
1281 EAXREVERB_MAXENVIRONMENTSIZE);
1284 void EaxReverbEffect::validate_environment_diffusion(
1285 float flEnvironmentDiffusion)
1287 eax_validate_range<EaxReverbEffectException>(
1288 "Environment Diffusion",
1289 flEnvironmentDiffusion,
1290 EAXREVERB_MINENVIRONMENTDIFFUSION,
1291 EAXREVERB_MAXENVIRONMENTDIFFUSION);
1294 void EaxReverbEffect::validate_room(
1295 long lRoom)
1297 eax_validate_range<EaxReverbEffectException>(
1298 "Room",
1299 lRoom,
1300 EAXREVERB_MINROOM,
1301 EAXREVERB_MAXROOM);
1304 void EaxReverbEffect::validate_room_hf(
1305 long lRoomHF)
1307 eax_validate_range<EaxReverbEffectException>(
1308 "Room HF",
1309 lRoomHF,
1310 EAXREVERB_MINROOMHF,
1311 EAXREVERB_MAXROOMHF);
1314 void EaxReverbEffect::validate_room_lf(
1315 long lRoomLF)
1317 eax_validate_range<EaxReverbEffectException>(
1318 "Room LF",
1319 lRoomLF,
1320 EAXREVERB_MINROOMLF,
1321 EAXREVERB_MAXROOMLF);
1324 void EaxReverbEffect::validate_decay_time(
1325 float flDecayTime)
1327 eax_validate_range<EaxReverbEffectException>(
1328 "Decay Time",
1329 flDecayTime,
1330 EAXREVERB_MINDECAYTIME,
1331 EAXREVERB_MAXDECAYTIME);
1334 void EaxReverbEffect::validate_decay_hf_ratio(
1335 float flDecayHFRatio)
1337 eax_validate_range<EaxReverbEffectException>(
1338 "Decay HF Ratio",
1339 flDecayHFRatio,
1340 EAXREVERB_MINDECAYHFRATIO,
1341 EAXREVERB_MAXDECAYHFRATIO);
1344 void EaxReverbEffect::validate_decay_lf_ratio(
1345 float flDecayLFRatio)
1347 eax_validate_range<EaxReverbEffectException>(
1348 "Decay LF Ratio",
1349 flDecayLFRatio,
1350 EAXREVERB_MINDECAYLFRATIO,
1351 EAXREVERB_MAXDECAYLFRATIO);
1354 void EaxReverbEffect::validate_reflections(
1355 long lReflections)
1357 eax_validate_range<EaxReverbEffectException>(
1358 "Reflections",
1359 lReflections,
1360 EAXREVERB_MINREFLECTIONS,
1361 EAXREVERB_MAXREFLECTIONS);
1364 void EaxReverbEffect::validate_reflections_delay(
1365 float flReflectionsDelay)
1367 eax_validate_range<EaxReverbEffectException>(
1368 "Reflections Delay",
1369 flReflectionsDelay,
1370 EAXREVERB_MINREFLECTIONSDELAY,
1371 EAXREVERB_MAXREFLECTIONSDELAY);
1374 void EaxReverbEffect::validate_reflections_pan(
1375 const EAXVECTOR& vReflectionsPan)
1377 std::ignore = vReflectionsPan;
1380 void EaxReverbEffect::validate_reverb(
1381 long lReverb)
1383 eax_validate_range<EaxReverbEffectException>(
1384 "Reverb",
1385 lReverb,
1386 EAXREVERB_MINREVERB,
1387 EAXREVERB_MAXREVERB);
1390 void EaxReverbEffect::validate_reverb_delay(
1391 float flReverbDelay)
1393 eax_validate_range<EaxReverbEffectException>(
1394 "Reverb Delay",
1395 flReverbDelay,
1396 EAXREVERB_MINREVERBDELAY,
1397 EAXREVERB_MAXREVERBDELAY);
1400 void EaxReverbEffect::validate_reverb_pan(
1401 const EAXVECTOR& vReverbPan)
1403 std::ignore = vReverbPan;
1406 void EaxReverbEffect::validate_echo_time(
1407 float flEchoTime)
1409 eax_validate_range<EaxReverbEffectException>(
1410 "Echo Time",
1411 flEchoTime,
1412 EAXREVERB_MINECHOTIME,
1413 EAXREVERB_MAXECHOTIME);
1416 void EaxReverbEffect::validate_echo_depth(
1417 float flEchoDepth)
1419 eax_validate_range<EaxReverbEffectException>(
1420 "Echo Depth",
1421 flEchoDepth,
1422 EAXREVERB_MINECHODEPTH,
1423 EAXREVERB_MAXECHODEPTH);
1426 void EaxReverbEffect::validate_modulation_time(
1427 float flModulationTime)
1429 eax_validate_range<EaxReverbEffectException>(
1430 "Modulation Time",
1431 flModulationTime,
1432 EAXREVERB_MINMODULATIONTIME,
1433 EAXREVERB_MAXMODULATIONTIME);
1436 void EaxReverbEffect::validate_modulation_depth(
1437 float flModulationDepth)
1439 eax_validate_range<EaxReverbEffectException>(
1440 "Modulation Depth",
1441 flModulationDepth,
1442 EAXREVERB_MINMODULATIONDEPTH,
1443 EAXREVERB_MAXMODULATIONDEPTH);
1446 void EaxReverbEffect::validate_air_absorbtion_hf(
1447 float air_absorbtion_hf)
1449 eax_validate_range<EaxReverbEffectException>(
1450 "Air Absorbtion HF",
1451 air_absorbtion_hf,
1452 EAXREVERB_MINAIRABSORPTIONHF,
1453 EAXREVERB_MAXAIRABSORPTIONHF);
1456 void EaxReverbEffect::validate_hf_reference(
1457 float flHFReference)
1459 eax_validate_range<EaxReverbEffectException>(
1460 "HF Reference",
1461 flHFReference,
1462 EAXREVERB_MINHFREFERENCE,
1463 EAXREVERB_MAXHFREFERENCE);
1466 void EaxReverbEffect::validate_lf_reference(
1467 float flLFReference)
1469 eax_validate_range<EaxReverbEffectException>(
1470 "LF Reference",
1471 flLFReference,
1472 EAXREVERB_MINLFREFERENCE,
1473 EAXREVERB_MAXLFREFERENCE);
1476 void EaxReverbEffect::validate_room_rolloff_factor(
1477 float flRoomRolloffFactor)
1479 eax_validate_range<EaxReverbEffectException>(
1480 "Room Rolloff Factor",
1481 flRoomRolloffFactor,
1482 EAXREVERB_MINROOMROLLOFFFACTOR,
1483 EAXREVERB_MAXROOMROLLOFFFACTOR);
1486 void EaxReverbEffect::validate_flags(
1487 unsigned long ulFlags)
1489 eax_validate_range<EaxReverbEffectException>(
1490 "Flags",
1491 ulFlags,
1492 0UL,
1493 ~EAXREVERBFLAGS_RESERVED);
1496 void EaxReverbEffect::validate_all(
1497 const EAX20LISTENERPROPERTIES& listener,
1498 int version)
1500 validate_room(listener.lRoom);
1501 validate_room_hf(listener.lRoomHF);
1502 validate_room_rolloff_factor(listener.flRoomRolloffFactor);
1503 validate_decay_time(listener.flDecayTime);
1504 validate_decay_hf_ratio(listener.flDecayHFRatio);
1505 validate_reflections(listener.lReflections);
1506 validate_reflections_delay(listener.flReflectionsDelay);
1507 validate_reverb(listener.lReverb);
1508 validate_reverb_delay(listener.flReverbDelay);
1509 validate_environment(listener.dwEnvironment, version, false);
1510 validate_environment_size(listener.flEnvironmentSize);
1511 validate_environment_diffusion(listener.flEnvironmentDiffusion);
1512 validate_air_absorbtion_hf(listener.flAirAbsorptionHF);
1513 validate_flags(listener.dwFlags);
1516 void EaxReverbEffect::validate_all(
1517 const EAXREVERBPROPERTIES& lReverb,
1518 int version)
1520 validate_environment(lReverb.ulEnvironment, version, false);
1521 validate_environment_size(lReverb.flEnvironmentSize);
1522 validate_environment_diffusion(lReverb.flEnvironmentDiffusion);
1523 validate_room(lReverb.lRoom);
1524 validate_room_hf(lReverb.lRoomHF);
1525 validate_room_lf(lReverb.lRoomLF);
1526 validate_decay_time(lReverb.flDecayTime);
1527 validate_decay_hf_ratio(lReverb.flDecayHFRatio);
1528 validate_decay_lf_ratio(lReverb.flDecayLFRatio);
1529 validate_reflections(lReverb.lReflections);
1530 validate_reflections_delay(lReverb.flReflectionsDelay);
1531 validate_reverb(lReverb.lReverb);
1532 validate_reverb_delay(lReverb.flReverbDelay);
1533 validate_echo_time(lReverb.flEchoTime);
1534 validate_echo_depth(lReverb.flEchoDepth);
1535 validate_modulation_time(lReverb.flModulationTime);
1536 validate_modulation_depth(lReverb.flModulationDepth);
1537 validate_air_absorbtion_hf(lReverb.flAirAbsorptionHF);
1538 validate_hf_reference(lReverb.flHFReference);
1539 validate_lf_reference(lReverb.flLFReference);
1540 validate_room_rolloff_factor(lReverb.flRoomRolloffFactor);
1541 validate_flags(lReverb.ulFlags);
1544 void EaxReverbEffect::v1_defer_environment(unsigned long environment)
1546 eax1_d_ = EAX1REVERB_PRESETS[environment];
1547 eax1_dirty_flags_.ulEnvironment = true;
1550 void EaxReverbEffect::v1_defer_volume(float volume)
1552 eax1_d_.fVolume = volume;
1553 eax1_dirty_flags_.flVolume = (eax1_.fVolume != eax1_d_.fVolume);
1556 void EaxReverbEffect::v1_defer_decay_time(float decay_time)
1558 eax1_d_.fDecayTime_sec = decay_time;
1559 eax1_dirty_flags_.flDecayTime = (eax1_.fDecayTime_sec != eax1_d_.fDecayTime_sec);
1562 void EaxReverbEffect::v1_defer_damping(float damping)
1564 eax1_d_.fDamping = damping;
1565 eax1_dirty_flags_.flDamping = (eax1_.fDamping != eax1_d_.fDamping);
1568 void EaxReverbEffect::v1_defer_all(const EAX_REVERBPROPERTIES& lReverb)
1570 v1_defer_environment(lReverb.environment);
1571 v1_defer_volume(lReverb.fVolume);
1572 v1_defer_decay_time(lReverb.fDecayTime_sec);
1573 v1_defer_damping(lReverb.fDamping);
1577 void EaxReverbEffect::v1_set_efx()
1579 auto efx_props = eax_efx_reverb_presets[eax1_.environment];
1580 efx_props.flGain = eax1_.fVolume;
1581 efx_props.flDecayTime = eax1_.fDecayTime_sec;
1582 efx_props.flDecayHFRatio = clamp(eax1_.fDamping, AL_EAXREVERB_MIN_DECAY_HFRATIO, AL_EAXREVERB_MAX_DECAY_HFRATIO);
1584 al_effect_props_.Reverb.Density = efx_props.flDensity;
1585 al_effect_props_.Reverb.Diffusion = efx_props.flDiffusion;
1586 al_effect_props_.Reverb.Gain = efx_props.flGain;
1587 al_effect_props_.Reverb.GainHF = efx_props.flGainHF;
1588 al_effect_props_.Reverb.GainLF = efx_props.flGainLF;
1589 al_effect_props_.Reverb.DecayTime = efx_props.flDecayTime;
1590 al_effect_props_.Reverb.DecayHFRatio = efx_props.flDecayHFRatio;
1591 al_effect_props_.Reverb.DecayLFRatio = efx_props.flDecayLFRatio;
1592 al_effect_props_.Reverb.ReflectionsGain = efx_props.flReflectionsGain;
1593 al_effect_props_.Reverb.ReflectionsDelay = efx_props.flReflectionsDelay;
1594 al_effect_props_.Reverb.ReflectionsPan[0] = efx_props.flReflectionsPan[0];
1595 al_effect_props_.Reverb.ReflectionsPan[1] = efx_props.flReflectionsPan[1];
1596 al_effect_props_.Reverb.ReflectionsPan[2] = efx_props.flReflectionsPan[2];
1597 al_effect_props_.Reverb.LateReverbGain = efx_props.flLateReverbGain;
1598 al_effect_props_.Reverb.LateReverbDelay = efx_props.flLateReverbDelay;
1599 al_effect_props_.Reverb.LateReverbPan[0] = efx_props.flLateReverbPan[0];
1600 al_effect_props_.Reverb.LateReverbPan[1] = efx_props.flLateReverbPan[1];
1601 al_effect_props_.Reverb.LateReverbPan[2] = efx_props.flLateReverbPan[2];
1602 al_effect_props_.Reverb.EchoTime = efx_props.flEchoTime;
1603 al_effect_props_.Reverb.EchoDepth = efx_props.flEchoDepth;
1604 al_effect_props_.Reverb.ModulationTime = efx_props.flModulationTime;
1605 al_effect_props_.Reverb.ModulationDepth = efx_props.flModulationDepth;
1606 al_effect_props_.Reverb.HFReference = efx_props.flHFReference;
1607 al_effect_props_.Reverb.LFReference = efx_props.flLFReference;
1608 al_effect_props_.Reverb.RoomRolloffFactor = efx_props.flRoomRolloffFactor;
1609 al_effect_props_.Reverb.AirAbsorptionGainHF = efx_props.flAirAbsorptionGainHF;
1610 al_effect_props_.Reverb.DecayHFLimit = false;
1613 void EaxReverbEffect::defer_environment(
1614 unsigned long ulEnvironment)
1616 eax_d_.ulEnvironment = ulEnvironment;
1617 eax_dirty_flags_.ulEnvironment = (eax_.ulEnvironment != eax_d_.ulEnvironment);
1620 void EaxReverbEffect::defer_environment_size(
1621 float flEnvironmentSize)
1623 eax_d_.flEnvironmentSize = flEnvironmentSize;
1624 eax_dirty_flags_.flEnvironmentSize = (eax_.flEnvironmentSize != eax_d_.flEnvironmentSize);
1627 void EaxReverbEffect::defer_environment_diffusion(
1628 float flEnvironmentDiffusion)
1630 eax_d_.flEnvironmentDiffusion = flEnvironmentDiffusion;
1631 eax_dirty_flags_.flEnvironmentDiffusion = (eax_.flEnvironmentDiffusion != eax_d_.flEnvironmentDiffusion);
1634 void EaxReverbEffect::defer_room(
1635 long lRoom)
1637 eax_d_.lRoom = lRoom;
1638 eax_dirty_flags_.lRoom = (eax_.lRoom != eax_d_.lRoom);
1641 void EaxReverbEffect::defer_room_hf(
1642 long lRoomHF)
1644 eax_d_.lRoomHF = lRoomHF;
1645 eax_dirty_flags_.lRoomHF = (eax_.lRoomHF != eax_d_.lRoomHF);
1648 void EaxReverbEffect::defer_room_lf(
1649 long lRoomLF)
1651 eax_d_.lRoomLF = lRoomLF;
1652 eax_dirty_flags_.lRoomLF = (eax_.lRoomLF != eax_d_.lRoomLF);
1655 void EaxReverbEffect::defer_decay_time(
1656 float flDecayTime)
1658 eax_d_.flDecayTime = flDecayTime;
1659 eax_dirty_flags_.flDecayTime = (eax_.flDecayTime != eax_d_.flDecayTime);
1662 void EaxReverbEffect::defer_decay_hf_ratio(
1663 float flDecayHFRatio)
1665 eax_d_.flDecayHFRatio = flDecayHFRatio;
1666 eax_dirty_flags_.flDecayHFRatio = (eax_.flDecayHFRatio != eax_d_.flDecayHFRatio);
1669 void EaxReverbEffect::defer_decay_lf_ratio(
1670 float flDecayLFRatio)
1672 eax_d_.flDecayLFRatio = flDecayLFRatio;
1673 eax_dirty_flags_.flDecayLFRatio = (eax_.flDecayLFRatio != eax_d_.flDecayLFRatio);
1676 void EaxReverbEffect::defer_reflections(
1677 long lReflections)
1679 eax_d_.lReflections = lReflections;
1680 eax_dirty_flags_.lReflections = (eax_.lReflections != eax_d_.lReflections);
1683 void EaxReverbEffect::defer_reflections_delay(
1684 float flReflectionsDelay)
1686 eax_d_.flReflectionsDelay = flReflectionsDelay;
1687 eax_dirty_flags_.flReflectionsDelay = (eax_.flReflectionsDelay != eax_d_.flReflectionsDelay);
1690 void EaxReverbEffect::defer_reflections_pan(
1691 const EAXVECTOR& vReflectionsPan)
1693 eax_d_.vReflectionsPan = vReflectionsPan;
1694 eax_dirty_flags_.vReflectionsPan = (eax_.vReflectionsPan != eax_d_.vReflectionsPan);
1697 void EaxReverbEffect::defer_reverb(
1698 long lReverb)
1700 eax_d_.lReverb = lReverb;
1701 eax_dirty_flags_.lReverb = (eax_.lReverb != eax_d_.lReverb);
1704 void EaxReverbEffect::defer_reverb_delay(
1705 float flReverbDelay)
1707 eax_d_.flReverbDelay = flReverbDelay;
1708 eax_dirty_flags_.flReverbDelay = (eax_.flReverbDelay != eax_d_.flReverbDelay);
1711 void EaxReverbEffect::defer_reverb_pan(
1712 const EAXVECTOR& vReverbPan)
1714 eax_d_.vReverbPan = vReverbPan;
1715 eax_dirty_flags_.vReverbPan = (eax_.vReverbPan != eax_d_.vReverbPan);
1718 void EaxReverbEffect::defer_echo_time(
1719 float flEchoTime)
1721 eax_d_.flEchoTime = flEchoTime;
1722 eax_dirty_flags_.flEchoTime = (eax_.flEchoTime != eax_d_.flEchoTime);
1725 void EaxReverbEffect::defer_echo_depth(
1726 float flEchoDepth)
1728 eax_d_.flEchoDepth = flEchoDepth;
1729 eax_dirty_flags_.flEchoDepth = (eax_.flEchoDepth != eax_d_.flEchoDepth);
1732 void EaxReverbEffect::defer_modulation_time(
1733 float flModulationTime)
1735 eax_d_.flModulationTime = flModulationTime;
1736 eax_dirty_flags_.flModulationTime = (eax_.flModulationTime != eax_d_.flModulationTime);
1739 void EaxReverbEffect::defer_modulation_depth(
1740 float flModulationDepth)
1742 eax_d_.flModulationDepth = flModulationDepth;
1743 eax_dirty_flags_.flModulationDepth = (eax_.flModulationDepth != eax_d_.flModulationDepth);
1746 void EaxReverbEffect::defer_air_absorbtion_hf(
1747 float flAirAbsorptionHF)
1749 eax_d_.flAirAbsorptionHF = flAirAbsorptionHF;
1750 eax_dirty_flags_.flAirAbsorptionHF = (eax_.flAirAbsorptionHF != eax_d_.flAirAbsorptionHF);
1753 void EaxReverbEffect::defer_hf_reference(
1754 float flHFReference)
1756 eax_d_.flHFReference = flHFReference;
1757 eax_dirty_flags_.flHFReference = (eax_.flHFReference != eax_d_.flHFReference);
1760 void EaxReverbEffect::defer_lf_reference(
1761 float flLFReference)
1763 eax_d_.flLFReference = flLFReference;
1764 eax_dirty_flags_.flLFReference = (eax_.flLFReference != eax_d_.flLFReference);
1767 void EaxReverbEffect::defer_room_rolloff_factor(
1768 float flRoomRolloffFactor)
1770 eax_d_.flRoomRolloffFactor = flRoomRolloffFactor;
1771 eax_dirty_flags_.flRoomRolloffFactor = (eax_.flRoomRolloffFactor != eax_d_.flRoomRolloffFactor);
1774 void EaxReverbEffect::defer_flags(
1775 unsigned long ulFlags)
1777 eax_d_.ulFlags = ulFlags;
1778 eax_dirty_flags_.ulFlags = (eax_.ulFlags != eax_d_.ulFlags);
1781 void EaxReverbEffect::defer_all(
1782 const EAX20LISTENERPROPERTIES& listener)
1784 defer_room(listener.lRoom);
1785 defer_room_hf(listener.lRoomHF);
1786 defer_room_rolloff_factor(listener.flRoomRolloffFactor);
1787 defer_decay_time(listener.flDecayTime);
1788 defer_decay_hf_ratio(listener.flDecayHFRatio);
1789 defer_reflections(listener.lReflections);
1790 defer_reflections_delay(listener.flReflectionsDelay);
1791 defer_reverb(listener.lReverb);
1792 defer_reverb_delay(listener.flReverbDelay);
1793 defer_environment(listener.dwEnvironment);
1794 defer_environment_size(listener.flEnvironmentSize);
1795 defer_environment_diffusion(listener.flEnvironmentDiffusion);
1796 defer_air_absorbtion_hf(listener.flAirAbsorptionHF);
1797 defer_flags(listener.dwFlags);
1800 void EaxReverbEffect::defer_all(
1801 const EAXREVERBPROPERTIES& lReverb)
1803 defer_environment(lReverb.ulEnvironment);
1804 defer_environment_size(lReverb.flEnvironmentSize);
1805 defer_environment_diffusion(lReverb.flEnvironmentDiffusion);
1806 defer_room(lReverb.lRoom);
1807 defer_room_hf(lReverb.lRoomHF);
1808 defer_room_lf(lReverb.lRoomLF);
1809 defer_decay_time(lReverb.flDecayTime);
1810 defer_decay_hf_ratio(lReverb.flDecayHFRatio);
1811 defer_decay_lf_ratio(lReverb.flDecayLFRatio);
1812 defer_reflections(lReverb.lReflections);
1813 defer_reflections_delay(lReverb.flReflectionsDelay);
1814 defer_reflections_pan(lReverb.vReflectionsPan);
1815 defer_reverb(lReverb.lReverb);
1816 defer_reverb_delay(lReverb.flReverbDelay);
1817 defer_reverb_pan(lReverb.vReverbPan);
1818 defer_echo_time(lReverb.flEchoTime);
1819 defer_echo_depth(lReverb.flEchoDepth);
1820 defer_modulation_time(lReverb.flModulationTime);
1821 defer_modulation_depth(lReverb.flModulationDepth);
1822 defer_air_absorbtion_hf(lReverb.flAirAbsorptionHF);
1823 defer_hf_reference(lReverb.flHFReference);
1824 defer_lf_reference(lReverb.flLFReference);
1825 defer_room_rolloff_factor(lReverb.flRoomRolloffFactor);
1826 defer_flags(lReverb.ulFlags);
1830 void EaxReverbEffect::v1_defer_environment(const EaxEaxCall& eax_call)
1832 const auto& environment = eax_call.get_value<EaxReverbEffectException,
1833 const decltype(EAX_REVERBPROPERTIES::environment)>();
1835 validate_environment(environment, 1, true);
1837 const auto& reverb_preset = EAX1REVERB_PRESETS[environment];
1838 v1_defer_all(reverb_preset);
1841 void EaxReverbEffect::v1_defer_volume(const EaxEaxCall& eax_call)
1843 const auto& volume = eax_call.get_value<EaxReverbEffectException,
1844 const decltype(EAX_REVERBPROPERTIES::fVolume)>();
1846 v1_validate_volume(volume);
1847 v1_defer_volume(volume);
1850 void EaxReverbEffect::v1_defer_decay_time(const EaxEaxCall& eax_call)
1852 const auto& decay_time = eax_call.get_value<EaxReverbEffectException,
1853 const decltype(EAX_REVERBPROPERTIES::fDecayTime_sec)>();
1855 v1_validate_decay_time(decay_time);
1856 v1_defer_decay_time(decay_time);
1859 void EaxReverbEffect::v1_defer_damping(const EaxEaxCall& eax_call)
1861 const auto& damping = eax_call.get_value<EaxReverbEffectException,
1862 const decltype(EAX_REVERBPROPERTIES::fDamping)>();
1864 v1_validate_damping(damping);
1865 v1_defer_damping(damping);
1868 void EaxReverbEffect::v1_defer_all(const EaxEaxCall& eax_call)
1870 const auto& reverb_all = eax_call.get_value<EaxReverbEffectException,
1871 const EAX_REVERBPROPERTIES>();
1873 v1_validate_all(reverb_all);
1874 v1_defer_all(reverb_all);
1878 void EaxReverbEffect::defer_environment(
1879 const EaxEaxCall& eax_call)
1881 const auto& ulEnvironment =
1882 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::ulEnvironment)>();
1884 validate_environment(ulEnvironment, eax_call.get_version(), true);
1886 if (eax_d_.ulEnvironment == ulEnvironment)
1888 return;
1891 const auto& reverb_preset = EAXREVERB_PRESETS[ulEnvironment];
1893 defer_all(reverb_preset);
1896 void EaxReverbEffect::defer_environment_size(
1897 const EaxEaxCall& eax_call)
1899 const auto& flEnvironmentSize =
1900 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flEnvironmentSize)>();
1902 validate_environment_size(flEnvironmentSize);
1904 if (eax_d_.flEnvironmentSize == flEnvironmentSize)
1906 return;
1909 const auto scale = flEnvironmentSize / eax_d_.flEnvironmentSize;
1911 defer_environment_size(flEnvironmentSize);
1913 if ((eax_d_.ulFlags & EAXREVERBFLAGS_DECAYTIMESCALE) != 0)
1915 const auto flDecayTime = clamp(
1916 scale * eax_d_.flDecayTime,
1917 EAXREVERB_MINDECAYTIME,
1918 EAXREVERB_MAXDECAYTIME);
1920 defer_decay_time(flDecayTime);
1923 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REFLECTIONSSCALE) != 0)
1925 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REFLECTIONSDELAYSCALE) != 0)
1927 const auto lReflections = clamp(
1928 eax_d_.lReflections - static_cast<long>(gain_to_level_mb(scale)),
1929 EAXREVERB_MINREFLECTIONS,
1930 EAXREVERB_MAXREFLECTIONS);
1932 defer_reflections(lReflections);
1936 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REFLECTIONSDELAYSCALE) != 0)
1938 const auto flReflectionsDelay = clamp(
1939 eax_d_.flReflectionsDelay * scale,
1940 EAXREVERB_MINREFLECTIONSDELAY,
1941 EAXREVERB_MAXREFLECTIONSDELAY);
1943 defer_reflections_delay(flReflectionsDelay);
1946 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REVERBSCALE) != 0)
1948 const auto log_scalar = ((eax_d_.ulFlags & EAXREVERBFLAGS_DECAYTIMESCALE) != 0) ? 2'000.0F : 3'000.0F;
1950 const auto lReverb = clamp(
1951 eax_d_.lReverb - static_cast<long>(std::log10(scale) * log_scalar),
1952 EAXREVERB_MINREVERB,
1953 EAXREVERB_MAXREVERB);
1955 defer_reverb(lReverb);
1958 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REVERBDELAYSCALE) != 0)
1960 const auto flReverbDelay = clamp(
1961 scale * eax_d_.flReverbDelay,
1962 EAXREVERB_MINREVERBDELAY,
1963 EAXREVERB_MAXREVERBDELAY);
1965 defer_reverb_delay(flReverbDelay);
1968 if ((eax_d_.ulFlags & EAXREVERBFLAGS_ECHOTIMESCALE) != 0)
1970 const auto flEchoTime = clamp(
1971 eax_d_.flEchoTime * scale,
1972 EAXREVERB_MINECHOTIME,
1973 EAXREVERB_MAXECHOTIME);
1975 defer_echo_time(flEchoTime);
1978 if ((eax_d_.ulFlags & EAXREVERBFLAGS_MODULATIONTIMESCALE) != 0)
1980 const auto flModulationTime = clamp(
1981 scale * eax_d_.flModulationTime,
1982 EAXREVERB_MINMODULATIONTIME,
1983 EAXREVERB_MAXMODULATIONTIME);
1985 defer_modulation_time(flModulationTime);
1989 void EaxReverbEffect::defer_environment_diffusion(
1990 const EaxEaxCall& eax_call)
1992 const auto& flEnvironmentDiffusion =
1993 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flEnvironmentDiffusion)>();
1995 validate_environment_diffusion(flEnvironmentDiffusion);
1996 defer_environment_diffusion(flEnvironmentDiffusion);
1999 void EaxReverbEffect::defer_room(
2000 const EaxEaxCall& eax_call)
2002 const auto& lRoom =
2003 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lRoom)>();
2005 validate_room(lRoom);
2006 defer_room(lRoom);
2009 void EaxReverbEffect::defer_room_hf(
2010 const EaxEaxCall& eax_call)
2012 const auto& lRoomHF =
2013 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lRoomHF)>();
2015 validate_room_hf(lRoomHF);
2016 defer_room_hf(lRoomHF);
2019 void EaxReverbEffect::defer_room_lf(
2020 const EaxEaxCall& eax_call)
2022 const auto& lRoomLF =
2023 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lRoomLF)>();
2025 validate_room_lf(lRoomLF);
2026 defer_room_lf(lRoomLF);
2029 void EaxReverbEffect::defer_decay_time(
2030 const EaxEaxCall& eax_call)
2032 const auto& flDecayTime =
2033 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flDecayTime)>();
2035 validate_decay_time(flDecayTime);
2036 defer_decay_time(flDecayTime);
2039 void EaxReverbEffect::defer_decay_hf_ratio(
2040 const EaxEaxCall& eax_call)
2042 const auto& flDecayHFRatio =
2043 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flDecayHFRatio)>();
2045 validate_decay_hf_ratio(flDecayHFRatio);
2046 defer_decay_hf_ratio(flDecayHFRatio);
2049 void EaxReverbEffect::defer_decay_lf_ratio(
2050 const EaxEaxCall& eax_call)
2052 const auto& flDecayLFRatio =
2053 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flDecayLFRatio)>();
2055 validate_decay_lf_ratio(flDecayLFRatio);
2056 defer_decay_lf_ratio(flDecayLFRatio);
2059 void EaxReverbEffect::defer_reflections(
2060 const EaxEaxCall& eax_call)
2062 const auto& lReflections =
2063 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lReflections)>();
2065 validate_reflections(lReflections);
2066 defer_reflections(lReflections);
2069 void EaxReverbEffect::defer_reflections_delay(
2070 const EaxEaxCall& eax_call)
2072 const auto& flReflectionsDelay =
2073 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flReflectionsDelay)>();
2075 validate_reflections_delay(flReflectionsDelay);
2076 defer_reflections_delay(flReflectionsDelay);
2079 void EaxReverbEffect::defer_reflections_pan(
2080 const EaxEaxCall& eax_call)
2082 const auto& vReflectionsPan =
2083 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::vReflectionsPan)>();
2085 validate_reflections_pan(vReflectionsPan);
2086 defer_reflections_pan(vReflectionsPan);
2089 void EaxReverbEffect::defer_reverb(
2090 const EaxEaxCall& eax_call)
2092 const auto& lReverb =
2093 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lReverb)>();
2095 validate_reverb(lReverb);
2096 defer_reverb(lReverb);
2099 void EaxReverbEffect::defer_reverb_delay(
2100 const EaxEaxCall& eax_call)
2102 const auto& flReverbDelay =
2103 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flReverbDelay)>();
2105 validate_reverb_delay(flReverbDelay);
2106 defer_reverb_delay(flReverbDelay);
2109 void EaxReverbEffect::defer_reverb_pan(
2110 const EaxEaxCall& eax_call)
2112 const auto& vReverbPan =
2113 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::vReverbPan)>();
2115 validate_reverb_pan(vReverbPan);
2116 defer_reverb_pan(vReverbPan);
2119 void EaxReverbEffect::defer_echo_time(
2120 const EaxEaxCall& eax_call)
2122 const auto& flEchoTime =
2123 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flEchoTime)>();
2125 validate_echo_time(flEchoTime);
2126 defer_echo_time(flEchoTime);
2129 void EaxReverbEffect::defer_echo_depth(
2130 const EaxEaxCall& eax_call)
2132 const auto& flEchoDepth =
2133 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flEchoDepth)>();
2135 validate_echo_depth(flEchoDepth);
2136 defer_echo_depth(flEchoDepth);
2139 void EaxReverbEffect::defer_modulation_time(
2140 const EaxEaxCall& eax_call)
2142 const auto& flModulationTime =
2143 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flModulationTime)>();
2145 validate_modulation_time(flModulationTime);
2146 defer_modulation_time(flModulationTime);
2149 void EaxReverbEffect::defer_modulation_depth(
2150 const EaxEaxCall& eax_call)
2152 const auto& flModulationDepth =
2153 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flModulationDepth)>();
2155 validate_modulation_depth(flModulationDepth);
2156 defer_modulation_depth(flModulationDepth);
2159 void EaxReverbEffect::defer_air_absorbtion_hf(
2160 const EaxEaxCall& eax_call)
2162 const auto& air_absorbtion_hf =
2163 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flAirAbsorptionHF)>();
2165 validate_air_absorbtion_hf(air_absorbtion_hf);
2166 defer_air_absorbtion_hf(air_absorbtion_hf);
2169 void EaxReverbEffect::defer_hf_reference(
2170 const EaxEaxCall& eax_call)
2172 const auto& flHFReference =
2173 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flHFReference)>();
2175 validate_hf_reference(flHFReference);
2176 defer_hf_reference(flHFReference);
2179 void EaxReverbEffect::defer_lf_reference(
2180 const EaxEaxCall& eax_call)
2182 const auto& flLFReference =
2183 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flLFReference)>();
2185 validate_lf_reference(flLFReference);
2186 defer_lf_reference(flLFReference);
2189 void EaxReverbEffect::defer_room_rolloff_factor(
2190 const EaxEaxCall& eax_call)
2192 const auto& flRoomRolloffFactor =
2193 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flRoomRolloffFactor)>();
2195 validate_room_rolloff_factor(flRoomRolloffFactor);
2196 defer_room_rolloff_factor(flRoomRolloffFactor);
2199 void EaxReverbEffect::defer_flags(
2200 const EaxEaxCall& eax_call)
2202 const auto& ulFlags =
2203 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::ulFlags)>();
2205 validate_flags(ulFlags);
2206 defer_flags(ulFlags);
2209 void EaxReverbEffect::defer_all(
2210 const EaxEaxCall& eax_call)
2212 const auto eax_version = eax_call.get_version();
2214 if (eax_version == 2)
2216 const auto& listener =
2217 eax_call.get_value<EaxReverbEffectException, const EAX20LISTENERPROPERTIES>();
2219 validate_all(listener, eax_version);
2220 defer_all(listener);
2222 else
2224 const auto& reverb_all =
2225 eax_call.get_value<EaxReverbEffectException, const EAXREVERBPROPERTIES>();
2227 validate_all(reverb_all, eax_version);
2228 defer_all(reverb_all);
2233 void EaxReverbEffect::v1_defer(const EaxEaxCall& eax_call)
2235 switch (eax_call.get_property_id())
2237 case DSPROPERTY_EAX_ALL: return v1_defer_all(eax_call);
2238 case DSPROPERTY_EAX_ENVIRONMENT: return v1_defer_environment(eax_call);
2239 case DSPROPERTY_EAX_VOLUME: return v1_defer_volume(eax_call);
2240 case DSPROPERTY_EAX_DECAYTIME: return v1_defer_decay_time(eax_call);
2241 case DSPROPERTY_EAX_DAMPING: return v1_defer_damping(eax_call);
2242 default: eax_fail("Unsupported property id.");
2246 // [[nodiscard]]
2247 bool EaxReverbEffect::apply_deferred()
2249 bool ret{false};
2251 if(unlikely(eax1_dirty_flags_ != Eax1ReverbEffectDirtyFlags{}))
2253 eax1_ = eax1_d_;
2255 v1_set_efx();
2257 eax1_dirty_flags_ = Eax1ReverbEffectDirtyFlags{};
2259 ret = true;
2262 if(eax_dirty_flags_ == EaxReverbEffectDirtyFlags{})
2263 return ret;
2265 eax_ = eax_d_;
2267 if (eax_dirty_flags_.ulEnvironment)
2271 if (eax_dirty_flags_.flEnvironmentSize)
2273 set_efx_density_from_environment_size();
2276 if (eax_dirty_flags_.flEnvironmentDiffusion)
2278 set_efx_diffusion();
2281 if (eax_dirty_flags_.lRoom)
2283 set_efx_gain();
2286 if (eax_dirty_flags_.lRoomHF)
2288 set_efx_gain_hf();
2291 if (eax_dirty_flags_.lRoomLF)
2293 set_efx_gain_lf();
2296 if (eax_dirty_flags_.flDecayTime)
2298 set_efx_decay_time();
2301 if (eax_dirty_flags_.flDecayHFRatio)
2303 set_efx_decay_hf_ratio();
2306 if (eax_dirty_flags_.flDecayLFRatio)
2308 set_efx_decay_lf_ratio();
2311 if (eax_dirty_flags_.lReflections)
2313 set_efx_reflections_gain();
2316 if (eax_dirty_flags_.flReflectionsDelay)
2318 set_efx_reflections_delay();
2321 if (eax_dirty_flags_.vReflectionsPan)
2323 set_efx_reflections_pan();
2326 if (eax_dirty_flags_.lReverb)
2328 set_efx_late_reverb_gain();
2331 if (eax_dirty_flags_.flReverbDelay)
2333 set_efx_late_reverb_delay();
2336 if (eax_dirty_flags_.vReverbPan)
2338 set_efx_late_reverb_pan();
2341 if (eax_dirty_flags_.flEchoTime)
2343 set_efx_echo_time();
2346 if (eax_dirty_flags_.flEchoDepth)
2348 set_efx_echo_depth();
2351 if (eax_dirty_flags_.flModulationTime)
2353 set_efx_modulation_time();
2356 if (eax_dirty_flags_.flModulationDepth)
2358 set_efx_modulation_depth();
2361 if (eax_dirty_flags_.flAirAbsorptionHF)
2363 set_efx_air_absorption_gain_hf();
2366 if (eax_dirty_flags_.flHFReference)
2368 set_efx_hf_reference();
2371 if (eax_dirty_flags_.flLFReference)
2373 set_efx_lf_reference();
2376 if (eax_dirty_flags_.flRoomRolloffFactor)
2378 set_efx_room_rolloff_factor();
2381 if (eax_dirty_flags_.ulFlags)
2383 set_efx_flags();
2386 eax_dirty_flags_ = EaxReverbEffectDirtyFlags{};
2388 return true;
2391 void EaxReverbEffect::set(const EaxEaxCall& eax_call)
2393 if(eax_call.get_version() == 1)
2394 v1_defer(eax_call);
2395 else switch(eax_call.get_property_id())
2397 case EAXREVERB_NONE:
2398 break;
2400 case EAXREVERB_ALLPARAMETERS:
2401 defer_all(eax_call);
2402 break;
2404 case EAXREVERB_ENVIRONMENT:
2405 defer_environment(eax_call);
2406 break;
2408 case EAXREVERB_ENVIRONMENTSIZE:
2409 defer_environment_size(eax_call);
2410 break;
2412 case EAXREVERB_ENVIRONMENTDIFFUSION:
2413 defer_environment_diffusion(eax_call);
2414 break;
2416 case EAXREVERB_ROOM:
2417 defer_room(eax_call);
2418 break;
2420 case EAXREVERB_ROOMHF:
2421 defer_room_hf(eax_call);
2422 break;
2424 case EAXREVERB_ROOMLF:
2425 defer_room_lf(eax_call);
2426 break;
2428 case EAXREVERB_DECAYTIME:
2429 defer_decay_time(eax_call);
2430 break;
2432 case EAXREVERB_DECAYHFRATIO:
2433 defer_decay_hf_ratio(eax_call);
2434 break;
2436 case EAXREVERB_DECAYLFRATIO:
2437 defer_decay_lf_ratio(eax_call);
2438 break;
2440 case EAXREVERB_REFLECTIONS:
2441 defer_reflections(eax_call);
2442 break;
2444 case EAXREVERB_REFLECTIONSDELAY:
2445 defer_reflections_delay(eax_call);
2446 break;
2448 case EAXREVERB_REFLECTIONSPAN:
2449 defer_reflections_pan(eax_call);
2450 break;
2452 case EAXREVERB_REVERB:
2453 defer_reverb(eax_call);
2454 break;
2456 case EAXREVERB_REVERBDELAY:
2457 defer_reverb_delay(eax_call);
2458 break;
2460 case EAXREVERB_REVERBPAN:
2461 defer_reverb_pan(eax_call);
2462 break;
2464 case EAXREVERB_ECHOTIME:
2465 defer_echo_time(eax_call);
2466 break;
2468 case EAXREVERB_ECHODEPTH:
2469 defer_echo_depth(eax_call);
2470 break;
2472 case EAXREVERB_MODULATIONTIME:
2473 defer_modulation_time(eax_call);
2474 break;
2476 case EAXREVERB_MODULATIONDEPTH:
2477 defer_modulation_depth(eax_call);
2478 break;
2480 case EAXREVERB_AIRABSORPTIONHF:
2481 defer_air_absorbtion_hf(eax_call);
2482 break;
2484 case EAXREVERB_HFREFERENCE:
2485 defer_hf_reference(eax_call);
2486 break;
2488 case EAXREVERB_LFREFERENCE:
2489 defer_lf_reference(eax_call);
2490 break;
2492 case EAXREVERB_ROOMROLLOFFFACTOR:
2493 defer_room_rolloff_factor(eax_call);
2494 break;
2496 case EAXREVERB_FLAGS:
2497 defer_flags(eax_call);
2498 break;
2500 default:
2501 eax_fail("Unsupported property id.");
2505 const EFXEAXREVERBPROPERTIES eax_efx_reverb_presets[EAX1_ENVIRONMENT_COUNT] =
2507 EFX_REVERB_PRESET_GENERIC,
2508 EFX_REVERB_PRESET_PADDEDCELL,
2509 EFX_REVERB_PRESET_ROOM,
2510 EFX_REVERB_PRESET_BATHROOM,
2511 EFX_REVERB_PRESET_LIVINGROOM,
2512 EFX_REVERB_PRESET_STONEROOM,
2513 EFX_REVERB_PRESET_AUDITORIUM,
2514 EFX_REVERB_PRESET_CONCERTHALL,
2515 EFX_REVERB_PRESET_CAVE,
2516 EFX_REVERB_PRESET_ARENA,
2517 EFX_REVERB_PRESET_HANGAR,
2518 EFX_REVERB_PRESET_CARPETEDHALLWAY,
2519 EFX_REVERB_PRESET_HALLWAY,
2520 EFX_REVERB_PRESET_STONECORRIDOR,
2521 EFX_REVERB_PRESET_ALLEY,
2522 EFX_REVERB_PRESET_FOREST,
2523 EFX_REVERB_PRESET_CITY,
2524 EFX_REVERB_PRESET_MOUNTAINS,
2525 EFX_REVERB_PRESET_QUARRY,
2526 EFX_REVERB_PRESET_PLAIN,
2527 EFX_REVERB_PRESET_PARKINGLOT,
2528 EFX_REVERB_PRESET_SEWERPIPE,
2529 EFX_REVERB_PRESET_UNDERWATER,
2530 EFX_REVERB_PRESET_DRUGGED,
2531 EFX_REVERB_PRESET_DIZZY,
2532 EFX_REVERB_PRESET_PSYCHOTIC,
2533 }; // EFXEAXREVERBPROPERTIES
2535 } // namespace
2537 EaxEffectUPtr eax_create_eax_reverb_effect()
2539 return std::make_unique<EaxReverbEffect>();
2542 #endif // ALSOFT_EAX