Define the CoreAudio default name only when needed
[openal-soft.git] / al / effects / reverb.cpp
blob46fa02562c0e470a8a40d7edbc62f147c3bec4ac
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 class EaxReverbEffect final :
604 public EaxEffect
606 public:
607 EaxReverbEffect();
609 // [[nodiscard]]
610 bool dispatch(
611 const EaxEaxCall& eax_call) override;
613 private:
614 EAX_REVERBPROPERTIES eax1_{};
615 EAXREVERBPROPERTIES eax_{};
616 EAXREVERBPROPERTIES eax_d_{};
617 EaxReverbEffectDirtyFlags eax_dirty_flags_{};
619 [[noreturn]] static void eax_fail(const char* message);
621 void set_eax_defaults();
624 void set_efx_density_from_environment_size();
626 void set_efx_diffusion();
628 void set_efx_gain();
630 void set_efx_gain_hf();
632 void set_efx_gain_lf();
634 void set_efx_decay_time();
636 void set_efx_decay_hf_ratio();
638 void set_efx_decay_lf_ratio();
640 void set_efx_reflections_gain();
642 void set_efx_reflections_delay();
644 void set_efx_reflections_pan();
646 void set_efx_late_reverb_gain();
648 void set_efx_late_reverb_delay();
650 void set_efx_late_reverb_pan();
652 void set_efx_echo_time();
654 void set_efx_echo_depth();
656 void set_efx_modulation_time();
658 void set_efx_modulation_depth();
660 void set_efx_air_absorption_gain_hf();
662 void set_efx_hf_reference();
664 void set_efx_lf_reference();
666 void set_efx_room_rolloff_factor();
668 void set_efx_flags();
670 void set_efx_defaults();
673 bool v1_get(const EaxEaxCall& eax_call) const;
675 void get_all(
676 const EaxEaxCall& eax_call) const;
678 // [[nodiscard]]
679 bool get(
680 const EaxEaxCall& eax_call) const;
683 static void v1_validate_environment(unsigned long environment);
684 static void v1_validate_volume(float volume);
685 static void v1_validate_decay_time(float decay_time);
686 static void v1_validate_damping(float damping);
687 static void v1_validate_all(const EAX_REVERBPROPERTIES& all);
689 static void validate_environment(
690 unsigned long ulEnvironment,
691 int version,
692 bool is_standalone);
694 static void validate_environment_size(
695 float flEnvironmentSize);
697 static void validate_environment_diffusion(
698 float flEnvironmentDiffusion);
700 static void validate_room(
701 long lRoom);
703 static void validate_room_hf(
704 long lRoomHF);
706 static void validate_room_lf(
707 long lRoomLF);
709 static void validate_decay_time(
710 float flDecayTime);
712 static void validate_decay_hf_ratio(
713 float flDecayHFRatio);
715 static void validate_decay_lf_ratio(
716 float flDecayLFRatio);
718 static void validate_reflections(
719 long lReflections);
721 static void validate_reflections_delay(
722 float flReflectionsDelay);
724 static void validate_reflections_pan(
725 const EAXVECTOR& vReflectionsPan);
727 static void validate_reverb(
728 long lReverb);
730 static void validate_reverb_delay(
731 float flReverbDelay);
733 static void validate_reverb_pan(
734 const EAXVECTOR& vReverbPan);
736 static void validate_echo_time(
737 float flEchoTime);
739 static void validate_echo_depth(
740 float flEchoDepth);
742 static void validate_modulation_time(
743 float flModulationTime);
745 static void validate_modulation_depth(
746 float flModulationDepth);
748 static void validate_air_absorbtion_hf(
749 float air_absorbtion_hf);
751 static void validate_hf_reference(
752 float flHFReference);
754 static void validate_lf_reference(
755 float flLFReference);
757 static void validate_room_rolloff_factor(
758 float flRoomRolloffFactor);
760 static void validate_flags(
761 unsigned long ulFlags);
763 static void validate_all(
764 const EAX20LISTENERPROPERTIES& all,
765 int version);
767 static void validate_all(
768 const EAXREVERBPROPERTIES& all,
769 int version);
772 void defer_environment(
773 unsigned long ulEnvironment);
775 void defer_environment_size(
776 float flEnvironmentSize);
778 void defer_environment_diffusion(
779 float flEnvironmentDiffusion);
781 void defer_room(
782 long lRoom);
784 void defer_room_hf(
785 long lRoomHF);
787 void defer_room_lf(
788 long lRoomLF);
790 void defer_decay_time(
791 float flDecayTime);
793 void defer_decay_hf_ratio(
794 float flDecayHFRatio);
796 void defer_decay_lf_ratio(
797 float flDecayLFRatio);
799 void defer_reflections(
800 long lReflections);
802 void defer_reflections_delay(
803 float flReflectionsDelay);
805 void defer_reflections_pan(
806 const EAXVECTOR& vReflectionsPan);
808 void defer_reverb(
809 long lReverb);
811 void defer_reverb_delay(
812 float flReverbDelay);
814 void defer_reverb_pan(
815 const EAXVECTOR& vReverbPan);
817 void defer_echo_time(
818 float flEchoTime);
820 void defer_echo_depth(
821 float flEchoDepth);
823 void defer_modulation_time(
824 float flModulationTime);
826 void defer_modulation_depth(
827 float flModulationDepth);
829 void defer_air_absorbtion_hf(
830 float flAirAbsorptionHF);
832 void defer_hf_reference(
833 float flHFReference);
835 void defer_lf_reference(
836 float flLFReference);
838 void defer_room_rolloff_factor(
839 float flRoomRolloffFactor);
841 void defer_flags(
842 unsigned long ulFlags);
844 void defer_all(
845 const EAX20LISTENERPROPERTIES& all);
847 void defer_all(
848 const EAXREVERBPROPERTIES& all);
851 void defer_environment(
852 const EaxEaxCall& eax_call);
854 void defer_environment_size(
855 const EaxEaxCall& eax_call);
857 void defer_environment_diffusion(
858 const EaxEaxCall& eax_call);
860 void defer_room(
861 const EaxEaxCall& eax_call);
863 void defer_room_hf(
864 const EaxEaxCall& eax_call);
866 void defer_room_lf(
867 const EaxEaxCall& eax_call);
869 void defer_decay_time(
870 const EaxEaxCall& eax_call);
872 void defer_decay_hf_ratio(
873 const EaxEaxCall& eax_call);
875 void defer_decay_lf_ratio(
876 const EaxEaxCall& eax_call);
878 void defer_reflections(
879 const EaxEaxCall& eax_call);
881 void defer_reflections_delay(
882 const EaxEaxCall& eax_call);
884 void defer_reflections_pan(
885 const EaxEaxCall& eax_call);
887 void defer_reverb(
888 const EaxEaxCall& eax_call);
890 void defer_reverb_delay(
891 const EaxEaxCall& eax_call);
893 void defer_reverb_pan(
894 const EaxEaxCall& eax_call);
896 void defer_echo_time(
897 const EaxEaxCall& eax_call);
899 void defer_echo_depth(
900 const EaxEaxCall& eax_call);
902 void defer_modulation_time(
903 const EaxEaxCall& eax_call);
905 void defer_modulation_depth(
906 const EaxEaxCall& eax_call);
908 void defer_air_absorbtion_hf(
909 const EaxEaxCall& eax_call);
911 void defer_hf_reference(
912 const EaxEaxCall& eax_call);
914 void defer_lf_reference(
915 const EaxEaxCall& eax_call);
917 void defer_room_rolloff_factor(
918 const EaxEaxCall& eax_call);
920 void defer_flags(
921 const EaxEaxCall& eax_call);
923 void defer_all(
924 const EaxEaxCall& eax_call);
927 void v1_set_efx();
928 bool v1_set_environment(const EaxEaxCall& eax_call);
929 bool v1_set_volume(const EaxEaxCall& eax_call);
930 bool v1_set_decay_time(const EaxEaxCall& eax_call);
931 bool v1_set_damping(const EaxEaxCall& eax_call);
932 bool v1_set_all(const EaxEaxCall& eax_call);
933 bool v1_set(const EaxEaxCall& eax_call);
935 // [[nodiscard]]
936 bool apply_deferred();
938 // [[nodiscard]]
939 bool set(
940 const EaxEaxCall& eax_call);
941 }; // EaxReverbEffect
944 class EaxReverbEffectException :
945 public EaxException
947 public:
948 explicit EaxReverbEffectException(
949 const char* message)
951 EaxException{"EAX_REVERB_EFFECT", message}
954 }; // EaxReverbEffectException
957 EaxReverbEffect::EaxReverbEffect()
958 : EaxEffect{AL_EFFECT_EAXREVERB}
960 set_eax_defaults();
961 set_efx_defaults();
964 // [[nodiscard]]
965 bool EaxReverbEffect::dispatch(
966 const EaxEaxCall& eax_call)
968 return eax_call.is_get() ? get(eax_call) : set(eax_call);
971 [[noreturn]] void EaxReverbEffect::eax_fail(const char* message)
973 throw EaxReverbEffectException{message};
976 void EaxReverbEffect::set_eax_defaults()
978 eax1_ = EAX1REVERB_PRESETS[EAX_ENVIRONMENT_GENERIC];
979 eax_ = EAXREVERB_PRESETS[EAX_ENVIRONMENT_GENERIC];
980 eax_d_ = eax_;
983 void EaxReverbEffect::set_efx_density_from_environment_size()
985 const auto eax_environment_size = eax_.flEnvironmentSize;
987 const auto efx_density = clamp(
988 (eax_environment_size * eax_environment_size * eax_environment_size) / 16.0F,
989 AL_EAXREVERB_MIN_DENSITY,
990 AL_EAXREVERB_MAX_DENSITY);
992 al_effect_props_.Reverb.Density = efx_density;
995 void EaxReverbEffect::set_efx_diffusion()
997 const auto efx_diffusion = clamp(
998 eax_.flEnvironmentDiffusion,
999 AL_EAXREVERB_MIN_DIFFUSION,
1000 AL_EAXREVERB_MAX_DIFFUSION);
1002 al_effect_props_.Reverb.Diffusion = efx_diffusion;
1005 void EaxReverbEffect::set_efx_gain()
1007 const auto efx_gain = clamp(
1008 level_mb_to_gain(static_cast<float>(eax_.lRoom)),
1009 AL_EAXREVERB_MIN_GAIN,
1010 AL_EAXREVERB_MAX_GAIN);
1012 al_effect_props_.Reverb.Gain = efx_gain;
1015 void EaxReverbEffect::set_efx_gain_hf()
1017 const auto efx_gain_hf = clamp(
1018 level_mb_to_gain(static_cast<float>(eax_.lRoomHF)),
1019 AL_EAXREVERB_MIN_GAINHF,
1020 AL_EAXREVERB_MAX_GAINHF);
1022 al_effect_props_.Reverb.GainHF = efx_gain_hf;
1025 void EaxReverbEffect::set_efx_gain_lf()
1027 const auto efx_gain_lf = clamp(
1028 level_mb_to_gain(static_cast<float>(eax_.lRoomLF)),
1029 AL_EAXREVERB_MIN_GAINLF,
1030 AL_EAXREVERB_MAX_GAINLF);
1032 al_effect_props_.Reverb.GainLF = efx_gain_lf;
1035 void EaxReverbEffect::set_efx_decay_time()
1037 const auto efx_decay_time = clamp(
1038 eax_.flDecayTime,
1039 AL_EAXREVERB_MIN_DECAY_TIME,
1040 AL_EAXREVERB_MAX_DECAY_TIME);
1042 al_effect_props_.Reverb.DecayTime = efx_decay_time;
1045 void EaxReverbEffect::set_efx_decay_hf_ratio()
1047 const auto efx_decay_hf_ratio = clamp(
1048 eax_.flDecayHFRatio,
1049 AL_EAXREVERB_MIN_DECAY_HFRATIO,
1050 AL_EAXREVERB_MAX_DECAY_HFRATIO);
1052 al_effect_props_.Reverb.DecayHFRatio = efx_decay_hf_ratio;
1055 void EaxReverbEffect::set_efx_decay_lf_ratio()
1057 const auto efx_decay_lf_ratio = clamp(
1058 eax_.flDecayLFRatio,
1059 AL_EAXREVERB_MIN_DECAY_LFRATIO,
1060 AL_EAXREVERB_MAX_DECAY_LFRATIO);
1062 al_effect_props_.Reverb.DecayLFRatio = efx_decay_lf_ratio;
1065 void EaxReverbEffect::set_efx_reflections_gain()
1067 const auto efx_reflections_gain = clamp(
1068 level_mb_to_gain(static_cast<float>(eax_.lReflections)),
1069 AL_EAXREVERB_MIN_REFLECTIONS_GAIN,
1070 AL_EAXREVERB_MAX_REFLECTIONS_GAIN);
1072 al_effect_props_.Reverb.ReflectionsGain = efx_reflections_gain;
1075 void EaxReverbEffect::set_efx_reflections_delay()
1077 const auto efx_reflections_delay = clamp(
1078 eax_.flReflectionsDelay,
1079 AL_EAXREVERB_MIN_REFLECTIONS_DELAY,
1080 AL_EAXREVERB_MAX_REFLECTIONS_DELAY);
1082 al_effect_props_.Reverb.ReflectionsDelay = efx_reflections_delay;
1085 void EaxReverbEffect::set_efx_reflections_pan()
1087 al_effect_props_.Reverb.ReflectionsPan[0] = eax_.vReflectionsPan.x;
1088 al_effect_props_.Reverb.ReflectionsPan[1] = eax_.vReflectionsPan.y;
1089 al_effect_props_.Reverb.ReflectionsPan[2] = eax_.vReflectionsPan.z;
1092 void EaxReverbEffect::set_efx_late_reverb_gain()
1094 const auto efx_late_reverb_gain = clamp(
1095 level_mb_to_gain(static_cast<float>(eax_.lReverb)),
1096 AL_EAXREVERB_MIN_LATE_REVERB_GAIN,
1097 AL_EAXREVERB_MAX_LATE_REVERB_GAIN);
1099 al_effect_props_.Reverb.LateReverbGain = efx_late_reverb_gain;
1102 void EaxReverbEffect::set_efx_late_reverb_delay()
1104 const auto efx_late_reverb_delay = clamp(
1105 eax_.flReverbDelay,
1106 AL_EAXREVERB_MIN_LATE_REVERB_DELAY,
1107 AL_EAXREVERB_MAX_LATE_REVERB_DELAY);
1109 al_effect_props_.Reverb.LateReverbDelay = efx_late_reverb_delay;
1112 void EaxReverbEffect::set_efx_late_reverb_pan()
1114 al_effect_props_.Reverb.LateReverbPan[0] = eax_.vReverbPan.x;
1115 al_effect_props_.Reverb.LateReverbPan[1] = eax_.vReverbPan.y;
1116 al_effect_props_.Reverb.LateReverbPan[2] = eax_.vReverbPan.z;
1119 void EaxReverbEffect::set_efx_echo_time()
1121 const auto efx_echo_time = clamp(
1122 eax_.flEchoTime,
1123 AL_EAXREVERB_MIN_ECHO_TIME,
1124 AL_EAXREVERB_MAX_ECHO_TIME);
1126 al_effect_props_.Reverb.EchoTime = efx_echo_time;
1129 void EaxReverbEffect::set_efx_echo_depth()
1131 const auto efx_echo_depth = clamp(
1132 eax_.flEchoDepth,
1133 AL_EAXREVERB_MIN_ECHO_DEPTH,
1134 AL_EAXREVERB_MAX_ECHO_DEPTH);
1136 al_effect_props_.Reverb.EchoDepth = efx_echo_depth;
1139 void EaxReverbEffect::set_efx_modulation_time()
1141 const auto efx_modulation_time = clamp(
1142 eax_.flModulationTime,
1143 AL_EAXREVERB_MIN_MODULATION_TIME,
1144 AL_EAXREVERB_MAX_MODULATION_TIME);
1146 al_effect_props_.Reverb.ModulationTime = efx_modulation_time;
1149 void EaxReverbEffect::set_efx_modulation_depth()
1151 const auto efx_modulation_depth = clamp(
1152 eax_.flModulationDepth,
1153 AL_EAXREVERB_MIN_MODULATION_DEPTH,
1154 AL_EAXREVERB_MAX_MODULATION_DEPTH);
1156 al_effect_props_.Reverb.ModulationDepth = efx_modulation_depth;
1159 void EaxReverbEffect::set_efx_air_absorption_gain_hf()
1161 const auto efx_air_absorption_hf = clamp(
1162 level_mb_to_gain(eax_.flAirAbsorptionHF),
1163 AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF,
1164 AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF);
1166 al_effect_props_.Reverb.AirAbsorptionGainHF = efx_air_absorption_hf;
1169 void EaxReverbEffect::set_efx_hf_reference()
1171 const auto efx_hf_reference = clamp(
1172 eax_.flHFReference,
1173 AL_EAXREVERB_MIN_HFREFERENCE,
1174 AL_EAXREVERB_MAX_HFREFERENCE);
1176 al_effect_props_.Reverb.HFReference = efx_hf_reference;
1179 void EaxReverbEffect::set_efx_lf_reference()
1181 const auto efx_lf_reference = clamp(
1182 eax_.flLFReference,
1183 AL_EAXREVERB_MIN_LFREFERENCE,
1184 AL_EAXREVERB_MAX_LFREFERENCE);
1186 al_effect_props_.Reverb.LFReference = efx_lf_reference;
1189 void EaxReverbEffect::set_efx_room_rolloff_factor()
1191 const auto efx_room_rolloff_factor = clamp(
1192 eax_.flRoomRolloffFactor,
1193 AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR,
1194 AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR);
1196 al_effect_props_.Reverb.RoomRolloffFactor = efx_room_rolloff_factor;
1199 void EaxReverbEffect::set_efx_flags()
1201 al_effect_props_.Reverb.DecayHFLimit = ((eax_.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0);
1204 void EaxReverbEffect::set_efx_defaults()
1206 set_efx_density_from_environment_size();
1207 set_efx_diffusion();
1208 set_efx_gain();
1209 set_efx_gain_hf();
1210 set_efx_gain_lf();
1211 set_efx_decay_time();
1212 set_efx_decay_hf_ratio();
1213 set_efx_decay_lf_ratio();
1214 set_efx_reflections_gain();
1215 set_efx_reflections_delay();
1216 set_efx_reflections_pan();
1217 set_efx_late_reverb_gain();
1218 set_efx_late_reverb_delay();
1219 set_efx_late_reverb_pan();
1220 set_efx_echo_time();
1221 set_efx_echo_depth();
1222 set_efx_modulation_time();
1223 set_efx_modulation_depth();
1224 set_efx_air_absorption_gain_hf();
1225 set_efx_hf_reference();
1226 set_efx_lf_reference();
1227 set_efx_room_rolloff_factor();
1228 set_efx_flags();
1231 bool EaxReverbEffect::v1_get(const EaxEaxCall& eax_call) const
1233 switch (eax_call.get_property_id())
1235 case DSPROPERTY_EAX_ALL:
1236 eax_call.set_value<EaxReverbEffectException>(eax1_);
1237 break;
1239 case DSPROPERTY_EAX_ENVIRONMENT:
1240 eax_call.set_value<EaxReverbEffectException>(eax1_.environment);
1241 break;
1243 case DSPROPERTY_EAX_VOLUME:
1244 eax_call.set_value<EaxReverbEffectException>(eax1_.fVolume);
1245 break;
1247 case DSPROPERTY_EAX_DECAYTIME:
1248 eax_call.set_value<EaxReverbEffectException>(eax1_.fDecayTime_sec);
1249 break;
1251 case DSPROPERTY_EAX_DAMPING:
1252 eax_call.set_value<EaxReverbEffectException>(eax1_.fDamping);
1253 break;
1255 default:
1256 eax_fail("Unsupported property id.");
1259 return false;
1262 void EaxReverbEffect::get_all(
1263 const EaxEaxCall& eax_call) const
1265 if (eax_call.get_version() == 2)
1267 auto& eax_reverb = eax_call.get_value<EaxReverbEffectException, EAX20LISTENERPROPERTIES>();
1268 eax_reverb.lRoom = eax_.lRoom;
1269 eax_reverb.lRoomHF = eax_.lRoomHF;
1270 eax_reverb.flRoomRolloffFactor = eax_.flRoomRolloffFactor;
1271 eax_reverb.flDecayTime = eax_.flDecayTime;
1272 eax_reverb.flDecayHFRatio = eax_.flDecayHFRatio;
1273 eax_reverb.lReflections = eax_.lReflections;
1274 eax_reverb.flReflectionsDelay = eax_.flReflectionsDelay;
1275 eax_reverb.lReverb = eax_.lReverb;
1276 eax_reverb.flReverbDelay = eax_.flReverbDelay;
1277 eax_reverb.dwEnvironment = eax_.ulEnvironment;
1278 eax_reverb.flEnvironmentSize = eax_.flEnvironmentSize;
1279 eax_reverb.flEnvironmentDiffusion = eax_.flEnvironmentDiffusion;
1280 eax_reverb.flAirAbsorptionHF = eax_.flAirAbsorptionHF;
1281 eax_reverb.dwFlags = eax_.ulFlags;
1283 else
1285 eax_call.set_value<EaxReverbEffectException>(eax_);
1289 // [[nodiscard]]
1290 bool EaxReverbEffect::get(
1291 const EaxEaxCall& eax_call) const
1293 if (eax_call.get_version() == 1)
1294 return v1_get(eax_call);
1296 switch (eax_call.get_property_id())
1298 case EAXREVERB_NONE:
1299 break;
1301 case EAXREVERB_ALLPARAMETERS:
1302 get_all(eax_call);
1303 break;
1305 case EAXREVERB_ENVIRONMENT:
1306 eax_call.set_value<EaxReverbEffectException>(eax_.ulEnvironment);
1307 break;
1309 case EAXREVERB_ENVIRONMENTSIZE:
1310 eax_call.set_value<EaxReverbEffectException>(eax_.flEnvironmentSize);
1311 break;
1313 case EAXREVERB_ENVIRONMENTDIFFUSION:
1314 eax_call.set_value<EaxReverbEffectException>(eax_.flEnvironmentDiffusion);
1315 break;
1317 case EAXREVERB_ROOM:
1318 eax_call.set_value<EaxReverbEffectException>(eax_.lRoom);
1319 break;
1321 case EAXREVERB_ROOMHF:
1322 eax_call.set_value<EaxReverbEffectException>(eax_.lRoomHF);
1323 break;
1325 case EAXREVERB_ROOMLF:
1326 eax_call.set_value<EaxReverbEffectException>(eax_.lRoomLF);
1327 break;
1329 case EAXREVERB_DECAYTIME:
1330 eax_call.set_value<EaxReverbEffectException>(eax_.flDecayTime);
1331 break;
1333 case EAXREVERB_DECAYHFRATIO:
1334 eax_call.set_value<EaxReverbEffectException>(eax_.flDecayHFRatio);
1335 break;
1337 case EAXREVERB_DECAYLFRATIO:
1338 eax_call.set_value<EaxReverbEffectException>(eax_.flDecayLFRatio);
1339 break;
1341 case EAXREVERB_REFLECTIONS:
1342 eax_call.set_value<EaxReverbEffectException>(eax_.lReflections);
1343 break;
1345 case EAXREVERB_REFLECTIONSDELAY:
1346 eax_call.set_value<EaxReverbEffectException>(eax_.flReflectionsDelay);
1347 break;
1349 case EAXREVERB_REFLECTIONSPAN:
1350 eax_call.set_value<EaxReverbEffectException>(eax_.vReflectionsPan);
1351 break;
1353 case EAXREVERB_REVERB:
1354 eax_call.set_value<EaxReverbEffectException>(eax_.lReverb);
1355 break;
1357 case EAXREVERB_REVERBDELAY:
1358 eax_call.set_value<EaxReverbEffectException>(eax_.flReverbDelay);
1359 break;
1361 case EAXREVERB_REVERBPAN:
1362 eax_call.set_value<EaxReverbEffectException>(eax_.vReverbPan);
1363 break;
1365 case EAXREVERB_ECHOTIME:
1366 eax_call.set_value<EaxReverbEffectException>(eax_.flEchoTime);
1367 break;
1369 case EAXREVERB_ECHODEPTH:
1370 eax_call.set_value<EaxReverbEffectException>(eax_.flEchoDepth);
1371 break;
1373 case EAXREVERB_MODULATIONTIME:
1374 eax_call.set_value<EaxReverbEffectException>(eax_.flModulationTime);
1375 break;
1377 case EAXREVERB_MODULATIONDEPTH:
1378 eax_call.set_value<EaxReverbEffectException>(eax_.flModulationDepth);
1379 break;
1381 case EAXREVERB_AIRABSORPTIONHF:
1382 eax_call.set_value<EaxReverbEffectException>(eax_.flAirAbsorptionHF);
1383 break;
1385 case EAXREVERB_HFREFERENCE:
1386 eax_call.set_value<EaxReverbEffectException>(eax_.flHFReference);
1387 break;
1389 case EAXREVERB_LFREFERENCE:
1390 eax_call.set_value<EaxReverbEffectException>(eax_.flLFReference);
1391 break;
1393 case EAXREVERB_ROOMROLLOFFFACTOR:
1394 eax_call.set_value<EaxReverbEffectException>(eax_.flRoomRolloffFactor);
1395 break;
1397 case EAXREVERB_FLAGS:
1398 eax_call.set_value<EaxReverbEffectException>(eax_.ulFlags);
1399 break;
1401 default:
1402 eax_fail("Unsupported property id.");
1405 return false;
1408 void EaxReverbEffect::v1_validate_environment(unsigned long environment)
1410 validate_environment(environment, 1, true);
1413 void EaxReverbEffect::v1_validate_volume(float volume)
1415 eax_validate_range<EaxReverbEffectException>("Volume", volume, EAX1REVERB_MINVOLUME, EAX1REVERB_MAXVOLUME);
1418 void EaxReverbEffect::v1_validate_decay_time(float decay_time)
1420 validate_decay_time(decay_time);
1423 void EaxReverbEffect::v1_validate_damping(float damping)
1425 eax_validate_range<EaxReverbEffectException>("Damping", damping, EAX1REVERB_MINDAMPING, EAX1REVERB_MAXDAMPING);
1428 void EaxReverbEffect::v1_validate_all(const EAX_REVERBPROPERTIES& all)
1430 v1_validate_environment(all.environment);
1431 v1_validate_volume(all.fVolume);
1432 v1_validate_decay_time(all.fDecayTime_sec);
1433 v1_validate_damping(all.fDamping);
1436 void EaxReverbEffect::validate_environment(
1437 unsigned long ulEnvironment,
1438 int version,
1439 bool is_standalone)
1441 eax_validate_range<EaxReverbEffectException>(
1442 "Environment",
1443 ulEnvironment,
1444 EAXREVERB_MINENVIRONMENT,
1445 (version <= 2 || is_standalone) ? EAX1REVERB_MAXENVIRONMENT : EAX30REVERB_MAXENVIRONMENT);
1448 void EaxReverbEffect::validate_environment_size(
1449 float flEnvironmentSize)
1451 eax_validate_range<EaxReverbEffectException>(
1452 "Environment Size",
1453 flEnvironmentSize,
1454 EAXREVERB_MINENVIRONMENTSIZE,
1455 EAXREVERB_MAXENVIRONMENTSIZE);
1458 void EaxReverbEffect::validate_environment_diffusion(
1459 float flEnvironmentDiffusion)
1461 eax_validate_range<EaxReverbEffectException>(
1462 "Environment Diffusion",
1463 flEnvironmentDiffusion,
1464 EAXREVERB_MINENVIRONMENTDIFFUSION,
1465 EAXREVERB_MAXENVIRONMENTDIFFUSION);
1468 void EaxReverbEffect::validate_room(
1469 long lRoom)
1471 eax_validate_range<EaxReverbEffectException>(
1472 "Room",
1473 lRoom,
1474 EAXREVERB_MINROOM,
1475 EAXREVERB_MAXROOM);
1478 void EaxReverbEffect::validate_room_hf(
1479 long lRoomHF)
1481 eax_validate_range<EaxReverbEffectException>(
1482 "Room HF",
1483 lRoomHF,
1484 EAXREVERB_MINROOMHF,
1485 EAXREVERB_MAXROOMHF);
1488 void EaxReverbEffect::validate_room_lf(
1489 long lRoomLF)
1491 eax_validate_range<EaxReverbEffectException>(
1492 "Room LF",
1493 lRoomLF,
1494 EAXREVERB_MINROOMLF,
1495 EAXREVERB_MAXROOMLF);
1498 void EaxReverbEffect::validate_decay_time(
1499 float flDecayTime)
1501 eax_validate_range<EaxReverbEffectException>(
1502 "Decay Time",
1503 flDecayTime,
1504 EAXREVERB_MINDECAYTIME,
1505 EAXREVERB_MAXDECAYTIME);
1508 void EaxReverbEffect::validate_decay_hf_ratio(
1509 float flDecayHFRatio)
1511 eax_validate_range<EaxReverbEffectException>(
1512 "Decay HF Ratio",
1513 flDecayHFRatio,
1514 EAXREVERB_MINDECAYHFRATIO,
1515 EAXREVERB_MAXDECAYHFRATIO);
1518 void EaxReverbEffect::validate_decay_lf_ratio(
1519 float flDecayLFRatio)
1521 eax_validate_range<EaxReverbEffectException>(
1522 "Decay LF Ratio",
1523 flDecayLFRatio,
1524 EAXREVERB_MINDECAYLFRATIO,
1525 EAXREVERB_MAXDECAYLFRATIO);
1528 void EaxReverbEffect::validate_reflections(
1529 long lReflections)
1531 eax_validate_range<EaxReverbEffectException>(
1532 "Reflections",
1533 lReflections,
1534 EAXREVERB_MINREFLECTIONS,
1535 EAXREVERB_MAXREFLECTIONS);
1538 void EaxReverbEffect::validate_reflections_delay(
1539 float flReflectionsDelay)
1541 eax_validate_range<EaxReverbEffectException>(
1542 "Reflections Delay",
1543 flReflectionsDelay,
1544 EAXREVERB_MINREFLECTIONSDELAY,
1545 EAXREVERB_MAXREFLECTIONSDELAY);
1548 void EaxReverbEffect::validate_reflections_pan(
1549 const EAXVECTOR& vReflectionsPan)
1551 std::ignore = vReflectionsPan;
1554 void EaxReverbEffect::validate_reverb(
1555 long lReverb)
1557 eax_validate_range<EaxReverbEffectException>(
1558 "Reverb",
1559 lReverb,
1560 EAXREVERB_MINREVERB,
1561 EAXREVERB_MAXREVERB);
1564 void EaxReverbEffect::validate_reverb_delay(
1565 float flReverbDelay)
1567 eax_validate_range<EaxReverbEffectException>(
1568 "Reverb Delay",
1569 flReverbDelay,
1570 EAXREVERB_MINREVERBDELAY,
1571 EAXREVERB_MAXREVERBDELAY);
1574 void EaxReverbEffect::validate_reverb_pan(
1575 const EAXVECTOR& vReverbPan)
1577 std::ignore = vReverbPan;
1580 void EaxReverbEffect::validate_echo_time(
1581 float flEchoTime)
1583 eax_validate_range<EaxReverbEffectException>(
1584 "Echo Time",
1585 flEchoTime,
1586 EAXREVERB_MINECHOTIME,
1587 EAXREVERB_MAXECHOTIME);
1590 void EaxReverbEffect::validate_echo_depth(
1591 float flEchoDepth)
1593 eax_validate_range<EaxReverbEffectException>(
1594 "Echo Depth",
1595 flEchoDepth,
1596 EAXREVERB_MINECHODEPTH,
1597 EAXREVERB_MAXECHODEPTH);
1600 void EaxReverbEffect::validate_modulation_time(
1601 float flModulationTime)
1603 eax_validate_range<EaxReverbEffectException>(
1604 "Modulation Time",
1605 flModulationTime,
1606 EAXREVERB_MINMODULATIONTIME,
1607 EAXREVERB_MAXMODULATIONTIME);
1610 void EaxReverbEffect::validate_modulation_depth(
1611 float flModulationDepth)
1613 eax_validate_range<EaxReverbEffectException>(
1614 "Modulation Depth",
1615 flModulationDepth,
1616 EAXREVERB_MINMODULATIONDEPTH,
1617 EAXREVERB_MAXMODULATIONDEPTH);
1620 void EaxReverbEffect::validate_air_absorbtion_hf(
1621 float air_absorbtion_hf)
1623 eax_validate_range<EaxReverbEffectException>(
1624 "Air Absorbtion HF",
1625 air_absorbtion_hf,
1626 EAXREVERB_MINAIRABSORPTIONHF,
1627 EAXREVERB_MAXAIRABSORPTIONHF);
1630 void EaxReverbEffect::validate_hf_reference(
1631 float flHFReference)
1633 eax_validate_range<EaxReverbEffectException>(
1634 "HF Reference",
1635 flHFReference,
1636 EAXREVERB_MINHFREFERENCE,
1637 EAXREVERB_MAXHFREFERENCE);
1640 void EaxReverbEffect::validate_lf_reference(
1641 float flLFReference)
1643 eax_validate_range<EaxReverbEffectException>(
1644 "LF Reference",
1645 flLFReference,
1646 EAXREVERB_MINLFREFERENCE,
1647 EAXREVERB_MAXLFREFERENCE);
1650 void EaxReverbEffect::validate_room_rolloff_factor(
1651 float flRoomRolloffFactor)
1653 eax_validate_range<EaxReverbEffectException>(
1654 "Room Rolloff Factor",
1655 flRoomRolloffFactor,
1656 EAXREVERB_MINROOMROLLOFFFACTOR,
1657 EAXREVERB_MAXROOMROLLOFFFACTOR);
1660 void EaxReverbEffect::validate_flags(
1661 unsigned long ulFlags)
1663 eax_validate_range<EaxReverbEffectException>(
1664 "Flags",
1665 ulFlags,
1666 0UL,
1667 ~EAXREVERBFLAGS_RESERVED);
1670 void EaxReverbEffect::validate_all(
1671 const EAX20LISTENERPROPERTIES& listener,
1672 int version)
1674 validate_room(listener.lRoom);
1675 validate_room_hf(listener.lRoomHF);
1676 validate_room_rolloff_factor(listener.flRoomRolloffFactor);
1677 validate_decay_time(listener.flDecayTime);
1678 validate_decay_hf_ratio(listener.flDecayHFRatio);
1679 validate_reflections(listener.lReflections);
1680 validate_reflections_delay(listener.flReflectionsDelay);
1681 validate_reverb(listener.lReverb);
1682 validate_reverb_delay(listener.flReverbDelay);
1683 validate_environment(listener.dwEnvironment, version, false);
1684 validate_environment_size(listener.flEnvironmentSize);
1685 validate_environment_diffusion(listener.flEnvironmentDiffusion);
1686 validate_air_absorbtion_hf(listener.flAirAbsorptionHF);
1687 validate_flags(listener.dwFlags);
1690 void EaxReverbEffect::validate_all(
1691 const EAXREVERBPROPERTIES& lReverb,
1692 int version)
1694 validate_environment(lReverb.ulEnvironment, version, false);
1695 validate_environment_size(lReverb.flEnvironmentSize);
1696 validate_environment_diffusion(lReverb.flEnvironmentDiffusion);
1697 validate_room(lReverb.lRoom);
1698 validate_room_hf(lReverb.lRoomHF);
1699 validate_room_lf(lReverb.lRoomLF);
1700 validate_decay_time(lReverb.flDecayTime);
1701 validate_decay_hf_ratio(lReverb.flDecayHFRatio);
1702 validate_decay_lf_ratio(lReverb.flDecayLFRatio);
1703 validate_reflections(lReverb.lReflections);
1704 validate_reflections_delay(lReverb.flReflectionsDelay);
1705 validate_reverb(lReverb.lReverb);
1706 validate_reverb_delay(lReverb.flReverbDelay);
1707 validate_echo_time(lReverb.flEchoTime);
1708 validate_echo_depth(lReverb.flEchoDepth);
1709 validate_modulation_time(lReverb.flModulationTime);
1710 validate_modulation_depth(lReverb.flModulationDepth);
1711 validate_air_absorbtion_hf(lReverb.flAirAbsorptionHF);
1712 validate_hf_reference(lReverb.flHFReference);
1713 validate_lf_reference(lReverb.flLFReference);
1714 validate_room_rolloff_factor(lReverb.flRoomRolloffFactor);
1715 validate_flags(lReverb.ulFlags);
1718 void EaxReverbEffect::v1_set_efx()
1720 auto efx_props = eax_efx_reverb_presets[eax1_.environment];
1721 efx_props.flGain = eax1_.fVolume;
1722 efx_props.flDecayTime = eax1_.fDecayTime_sec;
1723 efx_props.flDecayHFRatio = clamp(eax1_.fDamping, AL_EAXREVERB_MIN_DECAY_HFRATIO, AL_EAXREVERB_MAX_DECAY_HFRATIO);
1725 al_effect_props_.Reverb.Density = efx_props.flDensity;
1726 al_effect_props_.Reverb.Diffusion = efx_props.flDiffusion;
1727 al_effect_props_.Reverb.Gain = efx_props.flGain;
1728 al_effect_props_.Reverb.GainHF = efx_props.flGainHF;
1729 al_effect_props_.Reverb.GainLF = efx_props.flGainLF;
1730 al_effect_props_.Reverb.DecayTime = efx_props.flDecayTime;
1731 al_effect_props_.Reverb.DecayHFRatio = efx_props.flDecayHFRatio;
1732 al_effect_props_.Reverb.DecayLFRatio = efx_props.flDecayLFRatio;
1733 al_effect_props_.Reverb.ReflectionsGain = efx_props.flReflectionsGain;
1734 al_effect_props_.Reverb.ReflectionsDelay = efx_props.flReflectionsDelay;
1735 al_effect_props_.Reverb.ReflectionsPan[0] = efx_props.flReflectionsPan[0];
1736 al_effect_props_.Reverb.ReflectionsPan[1] = efx_props.flReflectionsPan[1];
1737 al_effect_props_.Reverb.ReflectionsPan[2] = efx_props.flReflectionsPan[2];
1738 al_effect_props_.Reverb.LateReverbGain = efx_props.flLateReverbGain;
1739 al_effect_props_.Reverb.LateReverbDelay = efx_props.flLateReverbDelay;
1740 al_effect_props_.Reverb.LateReverbPan[0] = efx_props.flLateReverbPan[0];
1741 al_effect_props_.Reverb.LateReverbPan[1] = efx_props.flLateReverbPan[1];
1742 al_effect_props_.Reverb.LateReverbPan[2] = efx_props.flLateReverbPan[2];
1743 al_effect_props_.Reverb.EchoTime = efx_props.flEchoTime;
1744 al_effect_props_.Reverb.EchoDepth = efx_props.flEchoDepth;
1745 al_effect_props_.Reverb.ModulationTime = efx_props.flModulationTime;
1746 al_effect_props_.Reverb.ModulationDepth = efx_props.flModulationDepth;
1747 al_effect_props_.Reverb.HFReference = efx_props.flHFReference;
1748 al_effect_props_.Reverb.LFReference = efx_props.flLFReference;
1749 al_effect_props_.Reverb.RoomRolloffFactor = efx_props.flRoomRolloffFactor;
1750 al_effect_props_.Reverb.AirAbsorptionGainHF = efx_props.flAirAbsorptionGainHF;
1751 al_effect_props_.Reverb.DecayHFLimit = false;
1754 void EaxReverbEffect::defer_environment(
1755 unsigned long ulEnvironment)
1757 eax_d_.ulEnvironment = ulEnvironment;
1758 eax_dirty_flags_.ulEnvironment = (eax_.ulEnvironment != eax_d_.ulEnvironment);
1761 void EaxReverbEffect::defer_environment_size(
1762 float flEnvironmentSize)
1764 eax_d_.flEnvironmentSize = flEnvironmentSize;
1765 eax_dirty_flags_.flEnvironmentSize = (eax_.flEnvironmentSize != eax_d_.flEnvironmentSize);
1768 void EaxReverbEffect::defer_environment_diffusion(
1769 float flEnvironmentDiffusion)
1771 eax_d_.flEnvironmentDiffusion = flEnvironmentDiffusion;
1772 eax_dirty_flags_.flEnvironmentDiffusion = (eax_.flEnvironmentDiffusion != eax_d_.flEnvironmentDiffusion);
1775 void EaxReverbEffect::defer_room(
1776 long lRoom)
1778 eax_d_.lRoom = lRoom;
1779 eax_dirty_flags_.lRoom = (eax_.lRoom != eax_d_.lRoom);
1782 void EaxReverbEffect::defer_room_hf(
1783 long lRoomHF)
1785 eax_d_.lRoomHF = lRoomHF;
1786 eax_dirty_flags_.lRoomHF = (eax_.lRoomHF != eax_d_.lRoomHF);
1789 void EaxReverbEffect::defer_room_lf(
1790 long lRoomLF)
1792 eax_d_.lRoomLF = lRoomLF;
1793 eax_dirty_flags_.lRoomLF = (eax_.lRoomLF != eax_d_.lRoomLF);
1796 void EaxReverbEffect::defer_decay_time(
1797 float flDecayTime)
1799 eax_d_.flDecayTime = flDecayTime;
1800 eax_dirty_flags_.flDecayTime = (eax_.flDecayTime != eax_d_.flDecayTime);
1803 void EaxReverbEffect::defer_decay_hf_ratio(
1804 float flDecayHFRatio)
1806 eax_d_.flDecayHFRatio = flDecayHFRatio;
1807 eax_dirty_flags_.flDecayHFRatio = (eax_.flDecayHFRatio != eax_d_.flDecayHFRatio);
1810 void EaxReverbEffect::defer_decay_lf_ratio(
1811 float flDecayLFRatio)
1813 eax_d_.flDecayLFRatio = flDecayLFRatio;
1814 eax_dirty_flags_.flDecayLFRatio = (eax_.flDecayLFRatio != eax_d_.flDecayLFRatio);
1817 void EaxReverbEffect::defer_reflections(
1818 long lReflections)
1820 eax_d_.lReflections = lReflections;
1821 eax_dirty_flags_.lReflections = (eax_.lReflections != eax_d_.lReflections);
1824 void EaxReverbEffect::defer_reflections_delay(
1825 float flReflectionsDelay)
1827 eax_d_.flReflectionsDelay = flReflectionsDelay;
1828 eax_dirty_flags_.flReflectionsDelay = (eax_.flReflectionsDelay != eax_d_.flReflectionsDelay);
1831 void EaxReverbEffect::defer_reflections_pan(
1832 const EAXVECTOR& vReflectionsPan)
1834 eax_d_.vReflectionsPan = vReflectionsPan;
1835 eax_dirty_flags_.vReflectionsPan = (eax_.vReflectionsPan != eax_d_.vReflectionsPan);
1838 void EaxReverbEffect::defer_reverb(
1839 long lReverb)
1841 eax_d_.lReverb = lReverb;
1842 eax_dirty_flags_.lReverb = (eax_.lReverb != eax_d_.lReverb);
1845 void EaxReverbEffect::defer_reverb_delay(
1846 float flReverbDelay)
1848 eax_d_.flReverbDelay = flReverbDelay;
1849 eax_dirty_flags_.flReverbDelay = (eax_.flReverbDelay != eax_d_.flReverbDelay);
1852 void EaxReverbEffect::defer_reverb_pan(
1853 const EAXVECTOR& vReverbPan)
1855 eax_d_.vReverbPan = vReverbPan;
1856 eax_dirty_flags_.vReverbPan = (eax_.vReverbPan != eax_d_.vReverbPan);
1859 void EaxReverbEffect::defer_echo_time(
1860 float flEchoTime)
1862 eax_d_.flEchoTime = flEchoTime;
1863 eax_dirty_flags_.flEchoTime = (eax_.flEchoTime != eax_d_.flEchoTime);
1866 void EaxReverbEffect::defer_echo_depth(
1867 float flEchoDepth)
1869 eax_d_.flEchoDepth = flEchoDepth;
1870 eax_dirty_flags_.flEchoDepth = (eax_.flEchoDepth != eax_d_.flEchoDepth);
1873 void EaxReverbEffect::defer_modulation_time(
1874 float flModulationTime)
1876 eax_d_.flModulationTime = flModulationTime;
1877 eax_dirty_flags_.flModulationTime = (eax_.flModulationTime != eax_d_.flModulationTime);
1880 void EaxReverbEffect::defer_modulation_depth(
1881 float flModulationDepth)
1883 eax_d_.flModulationDepth = flModulationDepth;
1884 eax_dirty_flags_.flModulationDepth = (eax_.flModulationDepth != eax_d_.flModulationDepth);
1887 void EaxReverbEffect::defer_air_absorbtion_hf(
1888 float flAirAbsorptionHF)
1890 eax_d_.flAirAbsorptionHF = flAirAbsorptionHF;
1891 eax_dirty_flags_.flAirAbsorptionHF = (eax_.flAirAbsorptionHF != eax_d_.flAirAbsorptionHF);
1894 void EaxReverbEffect::defer_hf_reference(
1895 float flHFReference)
1897 eax_d_.flHFReference = flHFReference;
1898 eax_dirty_flags_.flHFReference = (eax_.flHFReference != eax_d_.flHFReference);
1901 void EaxReverbEffect::defer_lf_reference(
1902 float flLFReference)
1904 eax_d_.flLFReference = flLFReference;
1905 eax_dirty_flags_.flLFReference = (eax_.flLFReference != eax_d_.flLFReference);
1908 void EaxReverbEffect::defer_room_rolloff_factor(
1909 float flRoomRolloffFactor)
1911 eax_d_.flRoomRolloffFactor = flRoomRolloffFactor;
1912 eax_dirty_flags_.flRoomRolloffFactor = (eax_.flRoomRolloffFactor != eax_d_.flRoomRolloffFactor);
1915 void EaxReverbEffect::defer_flags(
1916 unsigned long ulFlags)
1918 eax_d_.ulFlags = ulFlags;
1919 eax_dirty_flags_.ulFlags = (eax_.ulFlags != eax_d_.ulFlags);
1922 void EaxReverbEffect::defer_all(
1923 const EAX20LISTENERPROPERTIES& listener)
1925 defer_room(listener.lRoom);
1926 defer_room_hf(listener.lRoomHF);
1927 defer_room_rolloff_factor(listener.flRoomRolloffFactor);
1928 defer_decay_time(listener.flDecayTime);
1929 defer_decay_hf_ratio(listener.flDecayHFRatio);
1930 defer_reflections(listener.lReflections);
1931 defer_reflections_delay(listener.flReflectionsDelay);
1932 defer_reverb(listener.lReverb);
1933 defer_reverb_delay(listener.flReverbDelay);
1934 defer_environment(listener.dwEnvironment);
1935 defer_environment_size(listener.flEnvironmentSize);
1936 defer_environment_diffusion(listener.flEnvironmentDiffusion);
1937 defer_air_absorbtion_hf(listener.flAirAbsorptionHF);
1938 defer_flags(listener.dwFlags);
1941 void EaxReverbEffect::defer_all(
1942 const EAXREVERBPROPERTIES& lReverb)
1944 defer_environment(lReverb.ulEnvironment);
1945 defer_environment_size(lReverb.flEnvironmentSize);
1946 defer_environment_diffusion(lReverb.flEnvironmentDiffusion);
1947 defer_room(lReverb.lRoom);
1948 defer_room_hf(lReverb.lRoomHF);
1949 defer_room_lf(lReverb.lRoomLF);
1950 defer_decay_time(lReverb.flDecayTime);
1951 defer_decay_hf_ratio(lReverb.flDecayHFRatio);
1952 defer_decay_lf_ratio(lReverb.flDecayLFRatio);
1953 defer_reflections(lReverb.lReflections);
1954 defer_reflections_delay(lReverb.flReflectionsDelay);
1955 defer_reflections_pan(lReverb.vReflectionsPan);
1956 defer_reverb(lReverb.lReverb);
1957 defer_reverb_delay(lReverb.flReverbDelay);
1958 defer_reverb_pan(lReverb.vReverbPan);
1959 defer_echo_time(lReverb.flEchoTime);
1960 defer_echo_depth(lReverb.flEchoDepth);
1961 defer_modulation_time(lReverb.flModulationTime);
1962 defer_modulation_depth(lReverb.flModulationDepth);
1963 defer_air_absorbtion_hf(lReverb.flAirAbsorptionHF);
1964 defer_hf_reference(lReverb.flHFReference);
1965 defer_lf_reference(lReverb.flLFReference);
1966 defer_room_rolloff_factor(lReverb.flRoomRolloffFactor);
1967 defer_flags(lReverb.ulFlags);
1970 void EaxReverbEffect::defer_environment(
1971 const EaxEaxCall& eax_call)
1973 const auto& ulEnvironment =
1974 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::ulEnvironment)>();
1976 validate_environment(ulEnvironment, eax_call.get_version(), true);
1978 if (eax_d_.ulEnvironment == ulEnvironment)
1980 return;
1983 const auto& reverb_preset = EAXREVERB_PRESETS[ulEnvironment];
1985 defer_all(reverb_preset);
1988 void EaxReverbEffect::defer_environment_size(
1989 const EaxEaxCall& eax_call)
1991 const auto& flEnvironmentSize =
1992 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flEnvironmentSize)>();
1994 validate_environment_size(flEnvironmentSize);
1996 if (eax_d_.flEnvironmentSize == flEnvironmentSize)
1998 return;
2001 const auto scale = flEnvironmentSize / eax_d_.flEnvironmentSize;
2003 defer_environment_size(flEnvironmentSize);
2005 if ((eax_d_.ulFlags & EAXREVERBFLAGS_DECAYTIMESCALE) != 0)
2007 const auto flDecayTime = clamp(
2008 scale * eax_d_.flDecayTime,
2009 EAXREVERB_MINDECAYTIME,
2010 EAXREVERB_MAXDECAYTIME);
2012 defer_decay_time(flDecayTime);
2015 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REFLECTIONSSCALE) != 0)
2017 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REFLECTIONSDELAYSCALE) != 0)
2019 const auto lReflections = clamp(
2020 eax_d_.lReflections - static_cast<long>(gain_to_level_mb(scale)),
2021 EAXREVERB_MINREFLECTIONS,
2022 EAXREVERB_MAXREFLECTIONS);
2024 defer_reflections(lReflections);
2028 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REFLECTIONSDELAYSCALE) != 0)
2030 const auto flReflectionsDelay = clamp(
2031 eax_d_.flReflectionsDelay * scale,
2032 EAXREVERB_MINREFLECTIONSDELAY,
2033 EAXREVERB_MAXREFLECTIONSDELAY);
2035 defer_reflections_delay(flReflectionsDelay);
2038 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REVERBSCALE) != 0)
2040 const auto log_scalar = ((eax_d_.ulFlags & EAXREVERBFLAGS_DECAYTIMESCALE) != 0) ? 2'000.0F : 3'000.0F;
2042 const auto lReverb = clamp(
2043 eax_d_.lReverb - static_cast<long>(std::log10(scale) * log_scalar),
2044 EAXREVERB_MINREVERB,
2045 EAXREVERB_MAXREVERB);
2047 defer_reverb(lReverb);
2050 if ((eax_d_.ulFlags & EAXREVERBFLAGS_REVERBDELAYSCALE) != 0)
2052 const auto flReverbDelay = clamp(
2053 scale * eax_d_.flReverbDelay,
2054 EAXREVERB_MINREVERBDELAY,
2055 EAXREVERB_MAXREVERBDELAY);
2057 defer_reverb_delay(flReverbDelay);
2060 if ((eax_d_.ulFlags & EAXREVERBFLAGS_ECHOTIMESCALE) != 0)
2062 const auto flEchoTime = clamp(
2063 eax_d_.flEchoTime * scale,
2064 EAXREVERB_MINECHOTIME,
2065 EAXREVERB_MAXECHOTIME);
2067 defer_echo_time(flEchoTime);
2070 if ((eax_d_.ulFlags & EAXREVERBFLAGS_MODULATIONTIMESCALE) != 0)
2072 const auto flModulationTime = clamp(
2073 scale * eax_d_.flModulationTime,
2074 EAXREVERB_MINMODULATIONTIME,
2075 EAXREVERB_MAXMODULATIONTIME);
2077 defer_modulation_time(flModulationTime);
2081 void EaxReverbEffect::defer_environment_diffusion(
2082 const EaxEaxCall& eax_call)
2084 const auto& flEnvironmentDiffusion =
2085 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flEnvironmentDiffusion)>();
2087 validate_environment_diffusion(flEnvironmentDiffusion);
2088 defer_environment_diffusion(flEnvironmentDiffusion);
2091 void EaxReverbEffect::defer_room(
2092 const EaxEaxCall& eax_call)
2094 const auto& lRoom =
2095 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lRoom)>();
2097 validate_room(lRoom);
2098 defer_room(lRoom);
2101 void EaxReverbEffect::defer_room_hf(
2102 const EaxEaxCall& eax_call)
2104 const auto& lRoomHF =
2105 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lRoomHF)>();
2107 validate_room_hf(lRoomHF);
2108 defer_room_hf(lRoomHF);
2111 void EaxReverbEffect::defer_room_lf(
2112 const EaxEaxCall& eax_call)
2114 const auto& lRoomLF =
2115 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lRoomLF)>();
2117 validate_room_lf(lRoomLF);
2118 defer_room_lf(lRoomLF);
2121 void EaxReverbEffect::defer_decay_time(
2122 const EaxEaxCall& eax_call)
2124 const auto& flDecayTime =
2125 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flDecayTime)>();
2127 validate_decay_time(flDecayTime);
2128 defer_decay_time(flDecayTime);
2131 void EaxReverbEffect::defer_decay_hf_ratio(
2132 const EaxEaxCall& eax_call)
2134 const auto& flDecayHFRatio =
2135 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flDecayHFRatio)>();
2137 validate_decay_hf_ratio(flDecayHFRatio);
2138 defer_decay_hf_ratio(flDecayHFRatio);
2141 void EaxReverbEffect::defer_decay_lf_ratio(
2142 const EaxEaxCall& eax_call)
2144 const auto& flDecayLFRatio =
2145 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flDecayLFRatio)>();
2147 validate_decay_lf_ratio(flDecayLFRatio);
2148 defer_decay_lf_ratio(flDecayLFRatio);
2151 void EaxReverbEffect::defer_reflections(
2152 const EaxEaxCall& eax_call)
2154 const auto& lReflections =
2155 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lReflections)>();
2157 validate_reflections(lReflections);
2158 defer_reflections(lReflections);
2161 void EaxReverbEffect::defer_reflections_delay(
2162 const EaxEaxCall& eax_call)
2164 const auto& flReflectionsDelay =
2165 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flReflectionsDelay)>();
2167 validate_reflections_delay(flReflectionsDelay);
2168 defer_reflections_delay(flReflectionsDelay);
2171 void EaxReverbEffect::defer_reflections_pan(
2172 const EaxEaxCall& eax_call)
2174 const auto& vReflectionsPan =
2175 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::vReflectionsPan)>();
2177 validate_reflections_pan(vReflectionsPan);
2178 defer_reflections_pan(vReflectionsPan);
2181 void EaxReverbEffect::defer_reverb(
2182 const EaxEaxCall& eax_call)
2184 const auto& lReverb =
2185 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::lReverb)>();
2187 validate_reverb(lReverb);
2188 defer_reverb(lReverb);
2191 void EaxReverbEffect::defer_reverb_delay(
2192 const EaxEaxCall& eax_call)
2194 const auto& flReverbDelay =
2195 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flReverbDelay)>();
2197 validate_reverb_delay(flReverbDelay);
2198 defer_reverb_delay(flReverbDelay);
2201 void EaxReverbEffect::defer_reverb_pan(
2202 const EaxEaxCall& eax_call)
2204 const auto& vReverbPan =
2205 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::vReverbPan)>();
2207 validate_reverb_pan(vReverbPan);
2208 defer_reverb_pan(vReverbPan);
2211 void EaxReverbEffect::defer_echo_time(
2212 const EaxEaxCall& eax_call)
2214 const auto& flEchoTime =
2215 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flEchoTime)>();
2217 validate_echo_time(flEchoTime);
2218 defer_echo_time(flEchoTime);
2221 void EaxReverbEffect::defer_echo_depth(
2222 const EaxEaxCall& eax_call)
2224 const auto& flEchoDepth =
2225 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flEchoDepth)>();
2227 validate_echo_depth(flEchoDepth);
2228 defer_echo_depth(flEchoDepth);
2231 void EaxReverbEffect::defer_modulation_time(
2232 const EaxEaxCall& eax_call)
2234 const auto& flModulationTime =
2235 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flModulationTime)>();
2237 validate_modulation_time(flModulationTime);
2238 defer_modulation_time(flModulationTime);
2241 void EaxReverbEffect::defer_modulation_depth(
2242 const EaxEaxCall& eax_call)
2244 const auto& flModulationDepth =
2245 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flModulationDepth)>();
2247 validate_modulation_depth(flModulationDepth);
2248 defer_modulation_depth(flModulationDepth);
2251 void EaxReverbEffect::defer_air_absorbtion_hf(
2252 const EaxEaxCall& eax_call)
2254 const auto& air_absorbtion_hf =
2255 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flAirAbsorptionHF)>();
2257 validate_air_absorbtion_hf(air_absorbtion_hf);
2258 defer_air_absorbtion_hf(air_absorbtion_hf);
2261 void EaxReverbEffect::defer_hf_reference(
2262 const EaxEaxCall& eax_call)
2264 const auto& flHFReference =
2265 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flHFReference)>();
2267 validate_hf_reference(flHFReference);
2268 defer_hf_reference(flHFReference);
2271 void EaxReverbEffect::defer_lf_reference(
2272 const EaxEaxCall& eax_call)
2274 const auto& flLFReference =
2275 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flLFReference)>();
2277 validate_lf_reference(flLFReference);
2278 defer_lf_reference(flLFReference);
2281 void EaxReverbEffect::defer_room_rolloff_factor(
2282 const EaxEaxCall& eax_call)
2284 const auto& flRoomRolloffFactor =
2285 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::flRoomRolloffFactor)>();
2287 validate_room_rolloff_factor(flRoomRolloffFactor);
2288 defer_room_rolloff_factor(flRoomRolloffFactor);
2291 void EaxReverbEffect::defer_flags(
2292 const EaxEaxCall& eax_call)
2294 const auto& ulFlags =
2295 eax_call.get_value<EaxReverbEffectException, const decltype(EAXREVERBPROPERTIES::ulFlags)>();
2297 validate_flags(ulFlags);
2298 defer_flags(ulFlags);
2301 void EaxReverbEffect::defer_all(
2302 const EaxEaxCall& eax_call)
2304 const auto eax_version = eax_call.get_version();
2306 if (eax_version == 2)
2308 const auto& listener =
2309 eax_call.get_value<EaxReverbEffectException, const EAX20LISTENERPROPERTIES>();
2311 validate_all(listener, eax_version);
2312 defer_all(listener);
2314 else
2316 const auto& reverb_all =
2317 eax_call.get_value<EaxReverbEffectException, const EAXREVERBPROPERTIES>();
2319 validate_all(reverb_all, eax_version);
2320 defer_all(reverb_all);
2324 bool EaxReverbEffect::v1_set_environment(const EaxEaxCall& eax_call)
2326 const auto environment = eax_call.get_value<EaxReverbEffectException, const decltype(EAX_REVERBPROPERTIES::environment)>();
2327 v1_validate_environment(environment);
2329 if (eax1_.environment == environment)
2330 return false;
2332 eax1_.environment = environment;
2333 v1_set_efx();
2334 return true;
2337 bool EaxReverbEffect::v1_set_volume(const EaxEaxCall& eax_call)
2339 const auto volume = eax_call.get_value<EaxReverbEffectException, const decltype(EAX_REVERBPROPERTIES::fVolume)>();
2340 v1_validate_volume(volume);
2342 if (eax1_.fVolume == volume)
2343 return false;
2345 eax1_.fVolume = volume;
2346 v1_set_efx();
2347 return true;
2350 bool EaxReverbEffect::v1_set_decay_time(const EaxEaxCall& eax_call)
2352 const auto decay_time = eax_call.get_value<EaxReverbEffectException, const decltype(EAX_REVERBPROPERTIES::fDecayTime_sec)>();
2353 v1_validate_decay_time(decay_time);
2355 if (eax1_.fDecayTime_sec == decay_time)
2356 return false;
2358 eax1_.fDecayTime_sec = decay_time;
2359 v1_set_efx();
2360 return true;
2363 bool EaxReverbEffect::v1_set_damping(const EaxEaxCall& eax_call)
2365 const auto damping = eax_call.get_value<EaxReverbEffectException, const decltype(EAX_REVERBPROPERTIES::fDamping)>();
2366 v1_validate_damping(damping);
2368 if (eax1_.fDamping == damping)
2369 return false;
2371 eax1_.fDamping = damping;
2372 v1_set_efx();
2373 return true;
2376 bool EaxReverbEffect::v1_set_all(const EaxEaxCall& eax_call)
2378 const auto& all = eax_call.get_value<EaxReverbEffectException, const EAX_REVERBPROPERTIES>();
2379 v1_validate_all(all);
2381 if (eax1_ == all)
2382 return false;
2384 eax1_.environment = all.environment;
2385 eax1_.fVolume = all.fVolume;
2386 eax1_.fDecayTime_sec = all.fDecayTime_sec;
2387 eax1_.fDamping = all.fDamping;
2388 v1_set_efx();
2389 return true;
2392 bool EaxReverbEffect::v1_set(const EaxEaxCall& eax_call)
2394 switch (eax_call.get_property_id())
2396 case DSPROPERTY_EAX_ALL: return v1_set_all(eax_call);
2397 case DSPROPERTY_EAX_ENVIRONMENT: return v1_set_environment(eax_call);
2398 case DSPROPERTY_EAX_VOLUME: return v1_set_volume(eax_call);
2399 case DSPROPERTY_EAX_DECAYTIME: return v1_set_decay_time(eax_call);
2400 case DSPROPERTY_EAX_DAMPING: return v1_set_damping(eax_call);
2401 default: eax_fail("Unsupported property id.");
2405 // [[nodiscard]]
2406 bool EaxReverbEffect::apply_deferred()
2408 if (eax_dirty_flags_ == EaxReverbEffectDirtyFlags{})
2410 return false;
2413 eax_ = eax_d_;
2415 if (eax_dirty_flags_.ulEnvironment)
2419 if (eax_dirty_flags_.flEnvironmentSize)
2421 set_efx_density_from_environment_size();
2424 if (eax_dirty_flags_.flEnvironmentDiffusion)
2426 set_efx_diffusion();
2429 if (eax_dirty_flags_.lRoom)
2431 set_efx_gain();
2434 if (eax_dirty_flags_.lRoomHF)
2436 set_efx_gain_hf();
2439 if (eax_dirty_flags_.lRoomLF)
2441 set_efx_gain_lf();
2444 if (eax_dirty_flags_.flDecayTime)
2446 set_efx_decay_time();
2449 if (eax_dirty_flags_.flDecayHFRatio)
2451 set_efx_decay_hf_ratio();
2454 if (eax_dirty_flags_.flDecayLFRatio)
2456 set_efx_decay_lf_ratio();
2459 if (eax_dirty_flags_.lReflections)
2461 set_efx_reflections_gain();
2464 if (eax_dirty_flags_.flReflectionsDelay)
2466 set_efx_reflections_delay();
2469 if (eax_dirty_flags_.vReflectionsPan)
2471 set_efx_reflections_pan();
2474 if (eax_dirty_flags_.lReverb)
2476 set_efx_late_reverb_gain();
2479 if (eax_dirty_flags_.flReverbDelay)
2481 set_efx_late_reverb_delay();
2484 if (eax_dirty_flags_.vReverbPan)
2486 set_efx_late_reverb_pan();
2489 if (eax_dirty_flags_.flEchoTime)
2491 set_efx_echo_time();
2494 if (eax_dirty_flags_.flEchoDepth)
2496 set_efx_echo_depth();
2499 if (eax_dirty_flags_.flModulationTime)
2501 set_efx_modulation_time();
2504 if (eax_dirty_flags_.flModulationDepth)
2506 set_efx_modulation_depth();
2509 if (eax_dirty_flags_.flAirAbsorptionHF)
2511 set_efx_air_absorption_gain_hf();
2514 if (eax_dirty_flags_.flHFReference)
2516 set_efx_hf_reference();
2519 if (eax_dirty_flags_.flLFReference)
2521 set_efx_lf_reference();
2524 if (eax_dirty_flags_.flRoomRolloffFactor)
2526 set_efx_room_rolloff_factor();
2529 if (eax_dirty_flags_.ulFlags)
2531 set_efx_flags();
2534 eax_dirty_flags_ = EaxReverbEffectDirtyFlags{};
2536 return true;
2539 // [[nodiscard]]
2540 bool EaxReverbEffect::set(
2541 const EaxEaxCall& eax_call)
2543 if (eax_call.get_version() == 1)
2544 return v1_set(eax_call);
2546 switch (eax_call.get_property_id())
2548 case EAXREVERB_NONE:
2549 break;
2551 case EAXREVERB_ALLPARAMETERS:
2552 defer_all(eax_call);
2553 break;
2555 case EAXREVERB_ENVIRONMENT:
2556 defer_environment(eax_call);
2557 break;
2559 case EAXREVERB_ENVIRONMENTSIZE:
2560 defer_environment_size(eax_call);
2561 break;
2563 case EAXREVERB_ENVIRONMENTDIFFUSION:
2564 defer_environment_diffusion(eax_call);
2565 break;
2567 case EAXREVERB_ROOM:
2568 defer_room(eax_call);
2569 break;
2571 case EAXREVERB_ROOMHF:
2572 defer_room_hf(eax_call);
2573 break;
2575 case EAXREVERB_ROOMLF:
2576 defer_room_lf(eax_call);
2577 break;
2579 case EAXREVERB_DECAYTIME:
2580 defer_decay_time(eax_call);
2581 break;
2583 case EAXREVERB_DECAYHFRATIO:
2584 defer_decay_hf_ratio(eax_call);
2585 break;
2587 case EAXREVERB_DECAYLFRATIO:
2588 defer_decay_lf_ratio(eax_call);
2589 break;
2591 case EAXREVERB_REFLECTIONS:
2592 defer_reflections(eax_call);
2593 break;
2595 case EAXREVERB_REFLECTIONSDELAY:
2596 defer_reflections_delay(eax_call);
2597 break;
2599 case EAXREVERB_REFLECTIONSPAN:
2600 defer_reflections_pan(eax_call);
2601 break;
2603 case EAXREVERB_REVERB:
2604 defer_reverb(eax_call);
2605 break;
2607 case EAXREVERB_REVERBDELAY:
2608 defer_reverb_delay(eax_call);
2609 break;
2611 case EAXREVERB_REVERBPAN:
2612 defer_reverb_pan(eax_call);
2613 break;
2615 case EAXREVERB_ECHOTIME:
2616 defer_echo_time(eax_call);
2617 break;
2619 case EAXREVERB_ECHODEPTH:
2620 defer_echo_depth(eax_call);
2621 break;
2623 case EAXREVERB_MODULATIONTIME:
2624 defer_modulation_time(eax_call);
2625 break;
2627 case EAXREVERB_MODULATIONDEPTH:
2628 defer_modulation_depth(eax_call);
2629 break;
2631 case EAXREVERB_AIRABSORPTIONHF:
2632 defer_air_absorbtion_hf(eax_call);
2633 break;
2635 case EAXREVERB_HFREFERENCE:
2636 defer_hf_reference(eax_call);
2637 break;
2639 case EAXREVERB_LFREFERENCE:
2640 defer_lf_reference(eax_call);
2641 break;
2643 case EAXREVERB_ROOMROLLOFFFACTOR:
2644 defer_room_rolloff_factor(eax_call);
2645 break;
2647 case EAXREVERB_FLAGS:
2648 defer_flags(eax_call);
2649 break;
2651 default:
2652 eax_fail("Unsupported property id.");
2655 if (!eax_call.is_deferred())
2657 return apply_deferred();
2660 return false;
2663 const EFXEAXREVERBPROPERTIES eax_efx_reverb_presets[EAX1_ENVIRONMENT_COUNT] =
2665 EFX_REVERB_PRESET_GENERIC,
2666 EFX_REVERB_PRESET_PADDEDCELL,
2667 EFX_REVERB_PRESET_ROOM,
2668 EFX_REVERB_PRESET_BATHROOM,
2669 EFX_REVERB_PRESET_LIVINGROOM,
2670 EFX_REVERB_PRESET_STONEROOM,
2671 EFX_REVERB_PRESET_AUDITORIUM,
2672 EFX_REVERB_PRESET_CONCERTHALL,
2673 EFX_REVERB_PRESET_CAVE,
2674 EFX_REVERB_PRESET_ARENA,
2675 EFX_REVERB_PRESET_HANGAR,
2676 EFX_REVERB_PRESET_CARPETEDHALLWAY,
2677 EFX_REVERB_PRESET_HALLWAY,
2678 EFX_REVERB_PRESET_STONECORRIDOR,
2679 EFX_REVERB_PRESET_ALLEY,
2680 EFX_REVERB_PRESET_FOREST,
2681 EFX_REVERB_PRESET_CITY,
2682 EFX_REVERB_PRESET_MOUNTAINS,
2683 EFX_REVERB_PRESET_QUARRY,
2684 EFX_REVERB_PRESET_PLAIN,
2685 EFX_REVERB_PRESET_PARKINGLOT,
2686 EFX_REVERB_PRESET_SEWERPIPE,
2687 EFX_REVERB_PRESET_UNDERWATER,
2688 EFX_REVERB_PRESET_DRUGGED,
2689 EFX_REVERB_PRESET_DIZZY,
2690 EFX_REVERB_PRESET_PSYCHOTIC,
2691 }; // EFXEAXREVERBPROPERTIES
2693 } // namespace
2695 EaxEffectUPtr eax_create_eax_reverb_effect()
2697 return std::make_unique<EaxReverbEffect>();
2700 #endif // ALSOFT_EAX