9 #include "alc/effects/base.h"
14 #include "alnumeric.h"
15 #include "AL/efx-presets.h"
16 #include "al/eax/exception.h"
17 #include "al/eax/utils.h"
23 void Reverb_setParami(EffectProps *props, ALenum param, int val)
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;
34 throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
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)
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
116 case AL_EAXREVERB_ECHO_TIME:
117 if(!(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME))
118 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb echo time out of range"};
119 props->Reverb.EchoTime = val;
122 case AL_EAXREVERB_ECHO_DEPTH:
123 if(!(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH))
124 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb echo depth out of range"};
125 props->Reverb.EchoDepth = val;
128 case AL_EAXREVERB_MODULATION_TIME:
129 if(!(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME))
130 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb modulation time out of range"};
131 props->Reverb.ModulationTime = val;
134 case AL_EAXREVERB_MODULATION_DEPTH:
135 if(!(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH))
136 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb modulation depth out of range"};
137 props->Reverb.ModulationDepth = val;
140 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
141 if(!(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF))
142 throw effect_exception{AL_INVALID_VALUE, "EAX Reverb air absorption gainhf out of range"};
143 props->Reverb.AirAbsorptionGainHF = val;
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;
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;
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;
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)
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];
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];
188 Reverb_setParamf(props, param, vals[0]);
193 void Reverb_getParami(const EffectProps *props, ALenum param, int *val)
197 case AL_EAXREVERB_DECAY_HFLIMIT:
198 *val = props->Reverb.DecayHFLimit;
202 throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
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)
212 case AL_EAXREVERB_DENSITY:
213 *val = props->Reverb.Density;
216 case AL_EAXREVERB_DIFFUSION:
217 *val = props->Reverb.Diffusion;
220 case AL_EAXREVERB_GAIN:
221 *val = props->Reverb.Gain;
224 case AL_EAXREVERB_GAINHF:
225 *val = props->Reverb.GainHF;
228 case AL_EAXREVERB_GAINLF:
229 *val = props->Reverb.GainLF;
232 case AL_EAXREVERB_DECAY_TIME:
233 *val = props->Reverb.DecayTime;
236 case AL_EAXREVERB_DECAY_HFRATIO:
237 *val = props->Reverb.DecayHFRatio;
240 case AL_EAXREVERB_DECAY_LFRATIO:
241 *val = props->Reverb.DecayLFRatio;
244 case AL_EAXREVERB_REFLECTIONS_GAIN:
245 *val = props->Reverb.ReflectionsGain;
248 case AL_EAXREVERB_REFLECTIONS_DELAY:
249 *val = props->Reverb.ReflectionsDelay;
252 case AL_EAXREVERB_LATE_REVERB_GAIN:
253 *val = props->Reverb.LateReverbGain;
256 case AL_EAXREVERB_LATE_REVERB_DELAY:
257 *val = props->Reverb.LateReverbDelay;
260 case AL_EAXREVERB_ECHO_TIME:
261 *val = props->Reverb.EchoTime;
264 case AL_EAXREVERB_ECHO_DEPTH:
265 *val = props->Reverb.EchoDepth;
268 case AL_EAXREVERB_MODULATION_TIME:
269 *val = props->Reverb.ModulationTime;
272 case AL_EAXREVERB_MODULATION_DEPTH:
273 *val = props->Reverb.ModulationDepth;
276 case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
277 *val = props->Reverb.AirAbsorptionGainHF;
280 case AL_EAXREVERB_HFREFERENCE:
281 *val = props->Reverb.HFReference;
284 case AL_EAXREVERB_LFREFERENCE:
285 *val = props->Reverb.LFReference;
288 case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
289 *val = props->Reverb.RoomRolloffFactor;
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)
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];
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];
312 Reverb_getParamf(props, param, vals);
317 EffectProps genDefaultProps() noexcept
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;
351 void StdReverb_setParami(EffectProps *props, ALenum param, int val)
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;
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)
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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)
454 case AL_REVERB_DECAY_HFLIMIT:
455 *val = props->Reverb.DecayHFLimit;
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)
468 case AL_REVERB_DENSITY:
469 *val = props->Reverb.Density;
472 case AL_REVERB_DIFFUSION:
473 *val = props->Reverb.Diffusion;
477 *val = props->Reverb.Gain;
480 case AL_REVERB_GAINHF:
481 *val = props->Reverb.GainHF;
484 case AL_REVERB_DECAY_TIME:
485 *val = props->Reverb.DecayTime;
488 case AL_REVERB_DECAY_HFRATIO:
489 *val = props->Reverb.DecayHFRatio;
492 case AL_REVERB_REFLECTIONS_GAIN:
493 *val = props->Reverb.ReflectionsGain;
496 case AL_REVERB_REFLECTIONS_DELAY:
497 *val = props->Reverb.ReflectionsDelay;
500 case AL_REVERB_LATE_REVERB_GAIN:
501 *val = props->Reverb.LateReverbGain;
504 case AL_REVERB_LATE_REVERB_DELAY:
505 *val = props->Reverb.LateReverbDelay;
508 case AL_REVERB_AIR_ABSORPTION_GAINHF:
509 *val = props->Reverb.AirAbsorptionGainHF;
512 case AL_REVERB_ROOM_ROLLOFF_FACTOR:
513 *val = props->Reverb.RoomRolloffFactor;
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
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;
558 DEFINE_ALEFFECT_VTABLE(Reverb);
560 const EffectProps ReverbEffectProps{genDefaultProps()};
562 DEFINE_ALEFFECT_VTABLE(StdReverb);
564 const EffectProps StdReverbEffectProps{genDefaultStdProps()};
569 class EaxReverbEffectException : public EaxException
572 explicit EaxReverbEffectException(const char* message)
573 : EaxException{"EAX_REVERB_EFFECT", message}
575 }; // EaxReverbEffectException
577 struct EnvironmentValidator1 {
578 void operator()(unsigned long ulEnvironment) const
580 eax_validate_range<EaxReverbEffectException>(
583 EAXREVERB_MINENVIRONMENT,
584 EAX1REVERB_MAXENVIRONMENT);
586 }; // EnvironmentValidator1
588 struct VolumeValidator {
589 void operator()(float volume) const
591 eax_validate_range<EaxReverbEffectException>(
594 EAX1REVERB_MINVOLUME,
595 EAX1REVERB_MAXVOLUME);
597 }; // VolumeValidator
599 struct DecayTimeValidator {
600 void operator()(float flDecayTime) const
602 eax_validate_range<EaxReverbEffectException>(
605 EAXREVERB_MINDECAYTIME,
606 EAXREVERB_MAXDECAYTIME);
608 }; // DecayTimeValidator
610 struct DampingValidator {
611 void operator()(float damping) const
613 eax_validate_range<EaxReverbEffectException>(
616 EAX1REVERB_MINDAMPING,
617 EAX1REVERB_MAXDAMPING);
619 }; // DampingValidator
621 struct AllValidator1 {
622 void operator()(const EAX_REVERBPROPERTIES& all) const
624 EnvironmentValidator1{}(all.environment);
625 VolumeValidator{}(all.fVolume);
626 DecayTimeValidator{}(all.fDecayTime_sec);
627 DampingValidator{}(all.fDamping);
631 struct RoomValidator {
632 void operator()(long lRoom) const
634 eax_validate_range<EaxReverbEffectException>(
642 struct RoomHFValidator {
643 void operator()(long lRoomHF) const
645 eax_validate_range<EaxReverbEffectException>(
649 EAXREVERB_MAXROOMHF);
651 }; // RoomHFValidator
653 struct RoomRolloffFactorValidator {
654 void operator()(float flRoomRolloffFactor) const
656 eax_validate_range<EaxReverbEffectException>(
657 "Room Rolloff Factor",
659 EAXREVERB_MINROOMROLLOFFFACTOR,
660 EAXREVERB_MAXROOMROLLOFFFACTOR);
662 }; // RoomRolloffFactorValidator
664 struct DecayHFRatioValidator {
665 void operator()(float flDecayHFRatio) const
667 eax_validate_range<EaxReverbEffectException>(
670 EAXREVERB_MINDECAYHFRATIO,
671 EAXREVERB_MAXDECAYHFRATIO);
673 }; // DecayHFRatioValidator
675 struct ReflectionsValidator {
676 void operator()(long lReflections) const
678 eax_validate_range<EaxReverbEffectException>(
681 EAXREVERB_MINREFLECTIONS,
682 EAXREVERB_MAXREFLECTIONS);
684 }; // ReflectionsValidator
686 struct ReflectionsDelayValidator {
687 void operator()(float flReflectionsDelay) const
689 eax_validate_range<EaxReverbEffectException>(
692 EAXREVERB_MINREFLECTIONSDELAY,
693 EAXREVERB_MAXREFLECTIONSDELAY);
695 }; // ReflectionsDelayValidator
697 struct ReverbValidator {
698 void operator()(long lReverb) const
700 eax_validate_range<EaxReverbEffectException>(
704 EAXREVERB_MAXREVERB);
706 }; // ReverbValidator
708 struct ReverbDelayValidator {
709 void operator()(float flReverbDelay) const
711 eax_validate_range<EaxReverbEffectException>(
714 EAXREVERB_MINREVERBDELAY,
715 EAXREVERB_MAXREVERBDELAY);
717 }; // ReverbDelayValidator
719 struct EnvironmentSizeValidator {
720 void operator()(float flEnvironmentSize) const
722 eax_validate_range<EaxReverbEffectException>(
725 EAXREVERB_MINENVIRONMENTSIZE,
726 EAXREVERB_MAXENVIRONMENTSIZE);
728 }; // EnvironmentSizeValidator
730 struct EnvironmentDiffusionValidator {
731 void operator()(float flEnvironmentDiffusion) const
733 eax_validate_range<EaxReverbEffectException>(
734 "Environment Diffusion",
735 flEnvironmentDiffusion,
736 EAXREVERB_MINENVIRONMENTDIFFUSION,
737 EAXREVERB_MAXENVIRONMENTDIFFUSION);
739 }; // EnvironmentDiffusionValidator
741 struct AirAbsorptionHFValidator {
742 void operator()(float flAirAbsorptionHF) const
744 eax_validate_range<EaxReverbEffectException>(
747 EAXREVERB_MINAIRABSORPTIONHF,
748 EAXREVERB_MAXAIRABSORPTIONHF);
750 }; // AirAbsorptionHFValidator
752 struct FlagsValidator2 {
753 void operator()(unsigned long ulFlags) const
755 eax_validate_range<EaxReverbEffectException>(
759 ~EAX2LISTENERFLAGS_RESERVED);
761 }; // FlagsValidator2
763 struct AllValidator2 {
764 void operator()(const EAX20LISTENERPROPERTIES& all) const
766 RoomValidator{}(all.lRoom);
767 RoomHFValidator{}(all.lRoomHF);
768 RoomRolloffFactorValidator{}(all.flRoomRolloffFactor);
769 DecayTimeValidator{}(all.flDecayTime);
770 DecayHFRatioValidator{}(all.flDecayHFRatio);
771 ReflectionsValidator{}(all.lReflections);
772 ReflectionsDelayValidator{}(all.flReflectionsDelay);
773 ReverbValidator{}(all.lReverb);
774 ReverbDelayValidator{}(all.flReverbDelay);
775 EnvironmentValidator1{}(all.dwEnvironment);
776 EnvironmentSizeValidator{}(all.flEnvironmentSize);
777 EnvironmentDiffusionValidator{}(all.flEnvironmentDiffusion);
778 AirAbsorptionHFValidator{}(all.flAirAbsorptionHF);
779 FlagsValidator2{}(all.dwFlags);
783 struct EnvironmentValidator3 {
784 void operator()(unsigned long ulEnvironment) const
786 eax_validate_range<EaxReverbEffectException>(
789 EAXREVERB_MINENVIRONMENT,
790 EAX30REVERB_MAXENVIRONMENT);
792 }; // EnvironmentValidator1
794 struct RoomLFValidator {
795 void operator()(long lRoomLF) const
797 eax_validate_range<EaxReverbEffectException>(
801 EAXREVERB_MAXROOMLF);
803 }; // RoomLFValidator
805 struct DecayLFRatioValidator {
806 void operator()(float flDecayLFRatio) const
808 eax_validate_range<EaxReverbEffectException>(
811 EAXREVERB_MINDECAYLFRATIO,
812 EAXREVERB_MAXDECAYLFRATIO);
814 }; // DecayLFRatioValidator
816 struct VectorValidator {
817 void operator()(const EAXVECTOR&) const
819 }; // VectorValidator
821 struct EchoTimeValidator {
822 void operator()(float flEchoTime) const
824 eax_validate_range<EaxReverbEffectException>(
827 EAXREVERB_MINECHOTIME,
828 EAXREVERB_MAXECHOTIME);
830 }; // EchoTimeValidator
832 struct EchoDepthValidator {
833 void operator()(float flEchoDepth) const
835 eax_validate_range<EaxReverbEffectException>(
838 EAXREVERB_MINECHODEPTH,
839 EAXREVERB_MAXECHODEPTH);
841 }; // EchoDepthValidator
843 struct ModulationTimeValidator {
844 void operator()(float flModulationTime) const
846 eax_validate_range<EaxReverbEffectException>(
849 EAXREVERB_MINMODULATIONTIME,
850 EAXREVERB_MAXMODULATIONTIME);
852 }; // ModulationTimeValidator
854 struct ModulationDepthValidator {
855 void operator()(float flModulationDepth) const
857 eax_validate_range<EaxReverbEffectException>(
860 EAXREVERB_MINMODULATIONDEPTH,
861 EAXREVERB_MAXMODULATIONDEPTH);
863 }; // ModulationDepthValidator
865 struct HFReferenceValidator {
866 void operator()(float flHFReference) const
868 eax_validate_range<EaxReverbEffectException>(
871 EAXREVERB_MINHFREFERENCE,
872 EAXREVERB_MAXHFREFERENCE);
874 }; // HFReferenceValidator
876 struct LFReferenceValidator {
877 void operator()(float flLFReference) const
879 eax_validate_range<EaxReverbEffectException>(
882 EAXREVERB_MINLFREFERENCE,
883 EAXREVERB_MAXLFREFERENCE);
885 }; // LFReferenceValidator
887 struct FlagsValidator3 {
888 void operator()(unsigned long ulFlags) const
890 eax_validate_range<EaxReverbEffectException>(
894 ~EAXREVERBFLAGS_RESERVED);
896 }; // FlagsValidator3
898 struct AllValidator3 {
899 void operator()(const EAXREVERBPROPERTIES& all) const
901 EnvironmentValidator3{}(all.ulEnvironment);
902 EnvironmentSizeValidator{}(all.flEnvironmentSize);
903 EnvironmentDiffusionValidator{}(all.flEnvironmentDiffusion);
904 RoomValidator{}(all.lRoom);
905 RoomHFValidator{}(all.lRoomHF);
906 RoomLFValidator{}(all.lRoomLF);
907 DecayTimeValidator{}(all.flDecayTime);
908 DecayHFRatioValidator{}(all.flDecayHFRatio);
909 DecayLFRatioValidator{}(all.flDecayLFRatio);
910 ReflectionsValidator{}(all.lReflections);
911 ReflectionsDelayValidator{}(all.flReflectionsDelay);
912 VectorValidator{}(all.vReflectionsPan);
913 ReverbValidator{}(all.lReverb);
914 ReverbDelayValidator{}(all.flReverbDelay);
915 VectorValidator{}(all.vReverbPan);
916 EchoTimeValidator{}(all.flEchoTime);
917 EchoDepthValidator{}(all.flEchoDepth);
918 ModulationTimeValidator{}(all.flModulationTime);
919 ModulationDepthValidator{}(all.flModulationDepth);
920 AirAbsorptionHFValidator{}(all.flAirAbsorptionHF);
921 HFReferenceValidator{}(all.flHFReference);
922 LFReferenceValidator{}(all.flLFReference);
923 RoomRolloffFactorValidator{}(all.flRoomRolloffFactor);
924 FlagsValidator3{}(all.ulFlags);
928 struct EnvironmentDeferrer2 {
929 void operator()(EAX20LISTENERPROPERTIES& props, unsigned long dwEnvironment) const
931 props = EAX2REVERB_PRESETS[dwEnvironment];
933 }; // EnvironmentDeferrer2
935 struct EnvironmentSizeDeferrer2 {
936 void operator()(EAX20LISTENERPROPERTIES& props, float flEnvironmentSize) const
938 if (props.flEnvironmentSize == flEnvironmentSize)
943 const auto scale = flEnvironmentSize / props.flEnvironmentSize;
944 props.flEnvironmentSize = flEnvironmentSize;
946 if ((props.dwFlags & EAX2LISTENERFLAGS_DECAYTIMESCALE) != 0)
948 props.flDecayTime = clamp(
949 props.flDecayTime * scale,
950 EAXREVERB_MINDECAYTIME,
951 EAXREVERB_MAXDECAYTIME);
954 if ((props.dwFlags & EAX2LISTENERFLAGS_REFLECTIONSSCALE) != 0 &&
955 (props.dwFlags & EAX2LISTENERFLAGS_REFLECTIONSDELAYSCALE) != 0)
957 props.lReflections = clamp(
958 props.lReflections - static_cast<long>(gain_to_level_mb(scale)),
959 EAXREVERB_MINREFLECTIONS,
960 EAXREVERB_MAXREFLECTIONS);
963 if ((props.dwFlags & EAX2LISTENERFLAGS_REFLECTIONSDELAYSCALE) != 0)
965 props.flReflectionsDelay = clamp(
966 props.flReflectionsDelay * scale,
967 EAXREVERB_MINREFLECTIONSDELAY,
968 EAXREVERB_MAXREFLECTIONSDELAY);
971 if ((props.dwFlags & EAX2LISTENERFLAGS_REVERBSCALE) != 0)
973 const auto log_scalar = ((props.dwFlags & EAXREVERBFLAGS_DECAYTIMESCALE) != 0) ? 2'000.0F : 3'000.0F;
975 props.lReverb = clamp(
976 props.lReverb - static_cast<long>(std::log10(scale) * log_scalar),
978 EAXREVERB_MAXREVERB);
981 if ((props.dwFlags & EAX2LISTENERFLAGS_REVERBDELAYSCALE) != 0)
983 props.flReverbDelay = clamp(
984 props.flReverbDelay * scale,
985 EAXREVERB_MINREVERBDELAY,
986 EAXREVERB_MAXREVERBDELAY);
989 }; // EnvironmentSizeDeferrer2
991 struct EnvironmentDeferrer3 {
992 void operator()(EAXREVERBPROPERTIES& props, unsigned long ulEnvironment) const
994 if (ulEnvironment == EAX_ENVIRONMENT_UNDEFINED)
996 props.ulEnvironment = EAX_ENVIRONMENT_UNDEFINED;
1000 props = EAXREVERB_PRESETS[ulEnvironment];
1002 }; // EnvironmentDeferrer3
1004 struct EnvironmentSizeDeferrer3 {
1005 void operator()(EAXREVERBPROPERTIES& props, float flEnvironmentSize) const
1007 if (props.flEnvironmentSize == flEnvironmentSize)
1012 const auto scale = flEnvironmentSize / props.flEnvironmentSize;
1013 props.ulEnvironment = EAX_ENVIRONMENT_UNDEFINED;
1014 props.flEnvironmentSize = flEnvironmentSize;
1016 if ((props.ulFlags & EAXREVERBFLAGS_DECAYTIMESCALE) != 0)
1018 props.flDecayTime = clamp(
1019 props.flDecayTime * scale,
1020 EAXREVERB_MINDECAYTIME,
1021 EAXREVERB_MAXDECAYTIME);
1024 if ((props.ulFlags & EAXREVERBFLAGS_REFLECTIONSSCALE) != 0 &&
1025 (props.ulFlags & EAXREVERBFLAGS_REFLECTIONSDELAYSCALE) != 0)
1027 props.lReflections = clamp(
1028 props.lReflections - static_cast<long>(gain_to_level_mb(scale)),
1029 EAXREVERB_MINREFLECTIONS,
1030 EAXREVERB_MAXREFLECTIONS);
1033 if ((props.ulFlags & EAXREVERBFLAGS_REFLECTIONSDELAYSCALE) != 0)
1035 props.flReflectionsDelay = clamp(
1036 props.flReflectionsDelay * scale,
1037 EAXREVERB_MINREFLECTIONSDELAY,
1038 EAXREVERB_MAXREFLECTIONSDELAY);
1041 if ((props.ulFlags & EAXREVERBFLAGS_REVERBSCALE) != 0)
1043 const auto log_scalar = ((props.ulFlags & EAXREVERBFLAGS_DECAYTIMESCALE) != 0) ? 2'000.0F : 3'000.0F;
1044 props.lReverb = clamp(
1045 props.lReverb - static_cast<long>(std::log10(scale) * log_scalar),
1046 EAXREVERB_MINREVERB,
1047 EAXREVERB_MAXREVERB);
1050 if ((props.ulFlags & EAXREVERBFLAGS_REVERBDELAYSCALE) != 0)
1052 props.flReverbDelay = clamp(
1053 props.flReverbDelay * scale,
1054 EAXREVERB_MINREVERBDELAY,
1055 EAXREVERB_MAXREVERBDELAY);
1058 if ((props.ulFlags & EAXREVERBFLAGS_ECHOTIMESCALE) != 0)
1060 props.flEchoTime = clamp(
1061 props.flEchoTime * scale,
1062 EAXREVERB_MINECHOTIME,
1063 EAXREVERB_MAXECHOTIME);
1066 if ((props.ulFlags & EAXREVERBFLAGS_MODULATIONTIMESCALE) != 0)
1068 props.flModulationTime = clamp(
1069 props.flModulationTime * scale,
1070 EAXREVERB_MINMODULATIONTIME,
1071 EAXREVERB_MAXMODULATIONTIME);
1074 }; // EnvironmentSizeDeferrer3
1079 struct EaxReverbCommitter::Exception : public EaxReverbEffectException
1081 using EaxReverbEffectException::EaxReverbEffectException;
1084 [[noreturn]] void EaxReverbCommitter::fail(const char* message)
1086 throw Exception{message};
1089 void EaxReverbCommitter::translate(const EAX_REVERBPROPERTIES& src, EaxEffectProps& dst) noexcept
1091 assert(src.environment <= EAX1REVERB_MAXENVIRONMENT);
1092 dst.mType = EaxEffectType::Reverb;
1093 dst.mReverb = EAXREVERB_PRESETS[src.environment];
1094 dst.mReverb.flDecayTime = src.fDecayTime_sec;
1095 dst.mReverb.flDecayHFRatio = src.fDamping;
1096 dst.mReverb.lReverb = mini(static_cast<int>(gain_to_level_mb(src.fVolume)), 0);
1099 void EaxReverbCommitter::translate(const EAX20LISTENERPROPERTIES& src, EaxEffectProps& dst) noexcept
1101 assert(src.dwEnvironment <= EAX1REVERB_MAXENVIRONMENT);
1102 const auto& env = EAXREVERB_PRESETS[src.dwEnvironment];
1103 dst.mType = EaxEffectType::Reverb;
1104 dst.mReverb.ulEnvironment = src.dwEnvironment;
1105 dst.mReverb.flEnvironmentSize = src.flEnvironmentSize;
1106 dst.mReverb.flEnvironmentDiffusion = src.flEnvironmentDiffusion;
1107 dst.mReverb.lRoom = src.lRoom;
1108 dst.mReverb.lRoomHF = src.lRoomHF;
1109 dst.mReverb.lRoomLF = env.lRoomLF;
1110 dst.mReverb.flDecayTime = src.flDecayTime;
1111 dst.mReverb.flDecayHFRatio = src.flDecayHFRatio;
1112 dst.mReverb.flDecayLFRatio = env.flDecayLFRatio;
1113 dst.mReverb.lReflections = src.lReflections;
1114 dst.mReverb.flReflectionsDelay = src.flReflectionsDelay;
1115 dst.mReverb.vReflectionsPan = env.vReflectionsPan;
1116 dst.mReverb.lReverb = src.lReverb;
1117 dst.mReverb.flReverbDelay = src.flReverbDelay;
1118 dst.mReverb.vReverbPan = env.vReverbPan;
1119 dst.mReverb.flEchoTime = env.flEchoTime;
1120 dst.mReverb.flEchoDepth = env.flEchoDepth;
1121 dst.mReverb.flModulationTime = env.flModulationTime;
1122 dst.mReverb.flModulationDepth = env.flModulationDepth;
1123 dst.mReverb.flAirAbsorptionHF = src.flAirAbsorptionHF;
1124 dst.mReverb.flHFReference = env.flHFReference;
1125 dst.mReverb.flLFReference = env.flLFReference;
1126 dst.mReverb.flRoomRolloffFactor = src.flRoomRolloffFactor;
1127 dst.mReverb.ulFlags = src.dwFlags;
1130 void EaxReverbCommitter::translate(const EAXREVERBPROPERTIES& src, EaxEffectProps& dst) noexcept
1132 dst.mType = EaxEffectType::Reverb;
1136 bool EaxReverbCommitter::commit(const EAX_REVERBPROPERTIES &props)
1138 EaxEffectProps dst{};
1139 translate(props, dst);
1143 bool EaxReverbCommitter::commit(const EAX20LISTENERPROPERTIES &props)
1145 EaxEffectProps dst{};
1146 translate(props, dst);
1150 bool EaxReverbCommitter::commit(const EAXREVERBPROPERTIES &props)
1152 EaxEffectProps dst{};
1153 translate(props, dst);
1157 bool EaxReverbCommitter::commit(const EaxEffectProps &props)
1159 if(props.mType == mEaxProps.mType
1160 && memcmp(&props.mReverb, &mEaxProps.mReverb, sizeof(mEaxProps.mReverb)) == 0)
1165 const auto size = props.mReverb.flEnvironmentSize;
1166 const auto density = (size * size * size) / 16.0F;
1167 mAlProps.Reverb.Density = std::min(density, AL_EAXREVERB_MAX_DENSITY);
1168 mAlProps.Reverb.Diffusion = props.mReverb.flEnvironmentDiffusion;
1169 mAlProps.Reverb.Gain = level_mb_to_gain(static_cast<float>(props.mReverb.lRoom));
1170 mAlProps.Reverb.GainHF = level_mb_to_gain(static_cast<float>(props.mReverb.lRoomHF));
1171 mAlProps.Reverb.GainLF = level_mb_to_gain(static_cast<float>(props.mReverb.lRoomLF));
1172 mAlProps.Reverb.DecayTime = props.mReverb.flDecayTime;
1173 mAlProps.Reverb.DecayHFRatio = props.mReverb.flDecayHFRatio;
1174 mAlProps.Reverb.DecayLFRatio = mEaxProps.mReverb.flDecayLFRatio;
1175 mAlProps.Reverb.ReflectionsGain = level_mb_to_gain(static_cast<float>(props.mReverb.lReflections));
1176 mAlProps.Reverb.ReflectionsDelay = props.mReverb.flReflectionsDelay;
1177 mAlProps.Reverb.ReflectionsPan[0] = props.mReverb.vReflectionsPan.x;
1178 mAlProps.Reverb.ReflectionsPan[1] = props.mReverb.vReflectionsPan.y;
1179 mAlProps.Reverb.ReflectionsPan[2] = props.mReverb.vReflectionsPan.z;
1180 mAlProps.Reverb.LateReverbGain = level_mb_to_gain(static_cast<float>(props.mReverb.lReverb));
1181 mAlProps.Reverb.LateReverbDelay = props.mReverb.flReverbDelay;
1182 mAlProps.Reverb.LateReverbPan[0] = props.mReverb.vReverbPan.x;
1183 mAlProps.Reverb.LateReverbPan[1] = props.mReverb.vReverbPan.y;
1184 mAlProps.Reverb.LateReverbPan[2] = props.mReverb.vReverbPan.z;
1185 mAlProps.Reverb.EchoTime = props.mReverb.flEchoTime;
1186 mAlProps.Reverb.EchoDepth = props.mReverb.flEchoDepth;
1187 mAlProps.Reverb.ModulationTime = props.mReverb.flModulationTime;
1188 mAlProps.Reverb.ModulationDepth = props.mReverb.flModulationDepth;
1189 mAlProps.Reverb.AirAbsorptionGainHF = level_mb_to_gain(props.mReverb.flAirAbsorptionHF);
1190 mAlProps.Reverb.HFReference = props.mReverb.flHFReference;
1191 mAlProps.Reverb.LFReference = props.mReverb.flLFReference;
1192 mAlProps.Reverb.RoomRolloffFactor = props.mReverb.flRoomRolloffFactor;
1193 mAlProps.Reverb.DecayHFLimit = ((props.mReverb.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0);
1197 void EaxReverbCommitter::SetDefaults(EAX_REVERBPROPERTIES &props)
1199 props = EAX1REVERB_PRESETS[EAX_ENVIRONMENT_GENERIC];
1202 void EaxReverbCommitter::SetDefaults(EAX20LISTENERPROPERTIES &props)
1204 props = EAX2REVERB_PRESETS[EAX2_ENVIRONMENT_GENERIC];
1205 props.lRoom = -10'000L;
1208 void EaxReverbCommitter::SetDefaults(EAXREVERBPROPERTIES &props)
1210 props = EAXREVERB_PRESETS[EAX_ENVIRONMENT_GENERIC];
1213 void EaxReverbCommitter::SetDefaults(EaxEffectProps &props)
1215 props.mType = EaxEffectType::Reverb;
1216 SetDefaults(props.mReverb);
1220 void EaxReverbCommitter::Get(const EaxCall &call, const EAX_REVERBPROPERTIES &props)
1222 switch(call.get_property_id())
1224 case DSPROPERTY_EAX_ALL: call.set_value<Exception>(props); break;
1225 case DSPROPERTY_EAX_ENVIRONMENT: call.set_value<Exception>(props.environment); break;
1226 case DSPROPERTY_EAX_VOLUME: call.set_value<Exception>(props.fVolume); break;
1227 case DSPROPERTY_EAX_DECAYTIME: call.set_value<Exception>(props.fDecayTime_sec); break;
1228 case DSPROPERTY_EAX_DAMPING: call.set_value<Exception>(props.fDamping); break;
1229 default: fail_unknown_property_id();
1233 void EaxReverbCommitter::Get(const EaxCall &call, const EAX20LISTENERPROPERTIES &props)
1235 switch(call.get_property_id())
1237 case DSPROPERTY_EAX20LISTENER_NONE: break;
1238 case DSPROPERTY_EAX20LISTENER_ALLPARAMETERS: call.set_value<Exception>(props); break;
1239 case DSPROPERTY_EAX20LISTENER_ROOM: call.set_value<Exception>(props.lRoom); break;
1240 case DSPROPERTY_EAX20LISTENER_ROOMHF: call.set_value<Exception>(props.lRoomHF); break;
1241 case DSPROPERTY_EAX20LISTENER_ROOMROLLOFFFACTOR: call.set_value<Exception>(props.flRoomRolloffFactor); break;
1242 case DSPROPERTY_EAX20LISTENER_DECAYTIME: call.set_value<Exception>(props.flDecayTime); break;
1243 case DSPROPERTY_EAX20LISTENER_DECAYHFRATIO: call.set_value<Exception>(props.flDecayHFRatio); break;
1244 case DSPROPERTY_EAX20LISTENER_REFLECTIONS: call.set_value<Exception>(props.lReflections); break;
1245 case DSPROPERTY_EAX20LISTENER_REFLECTIONSDELAY: call.set_value<Exception>(props.flReflectionsDelay); break;
1246 case DSPROPERTY_EAX20LISTENER_REVERB: call.set_value<Exception>(props.lReverb); break;
1247 case DSPROPERTY_EAX20LISTENER_REVERBDELAY: call.set_value<Exception>(props.flReverbDelay); break;
1248 case DSPROPERTY_EAX20LISTENER_ENVIRONMENT: call.set_value<Exception>(props.dwEnvironment); break;
1249 case DSPROPERTY_EAX20LISTENER_ENVIRONMENTSIZE: call.set_value<Exception>(props.flEnvironmentSize); break;
1250 case DSPROPERTY_EAX20LISTENER_ENVIRONMENTDIFFUSION: call.set_value<Exception>(props.flEnvironmentDiffusion); break;
1251 case DSPROPERTY_EAX20LISTENER_AIRABSORPTIONHF: call.set_value<Exception>(props.flAirAbsorptionHF); break;
1252 case DSPROPERTY_EAX20LISTENER_FLAGS: call.set_value<Exception>(props.dwFlags); break;
1253 default: fail_unknown_property_id();
1257 void EaxReverbCommitter::Get(const EaxCall &call, const EAXREVERBPROPERTIES &props)
1259 switch(call.get_property_id())
1261 case EAXREVERB_NONE: break;
1262 case EAXREVERB_ALLPARAMETERS: call.set_value<Exception>(props); break;
1263 case EAXREVERB_ENVIRONMENT: call.set_value<Exception>(props.ulEnvironment); break;
1264 case EAXREVERB_ENVIRONMENTSIZE: call.set_value<Exception>(props.flEnvironmentSize); break;
1265 case EAXREVERB_ENVIRONMENTDIFFUSION: call.set_value<Exception>(props.flEnvironmentDiffusion); break;
1266 case EAXREVERB_ROOM: call.set_value<Exception>(props.lRoom); break;
1267 case EAXREVERB_ROOMHF: call.set_value<Exception>(props.lRoomHF); break;
1268 case EAXREVERB_ROOMLF: call.set_value<Exception>(props.lRoomLF); break;
1269 case EAXREVERB_DECAYTIME: call.set_value<Exception>(props.flDecayTime); break;
1270 case EAXREVERB_DECAYHFRATIO: call.set_value<Exception>(props.flDecayHFRatio); break;
1271 case EAXREVERB_DECAYLFRATIO: call.set_value<Exception>(props.flDecayLFRatio); break;
1272 case EAXREVERB_REFLECTIONS: call.set_value<Exception>(props.lReflections); break;
1273 case EAXREVERB_REFLECTIONSDELAY: call.set_value<Exception>(props.flReflectionsDelay); break;
1274 case EAXREVERB_REFLECTIONSPAN: call.set_value<Exception>(props.vReflectionsPan); break;
1275 case EAXREVERB_REVERB: call.set_value<Exception>(props.lReverb); break;
1276 case EAXREVERB_REVERBDELAY: call.set_value<Exception>(props.flReverbDelay); break;
1277 case EAXREVERB_REVERBPAN: call.set_value<Exception>(props.vReverbPan); break;
1278 case EAXREVERB_ECHOTIME: call.set_value<Exception>(props.flEchoTime); break;
1279 case EAXREVERB_ECHODEPTH: call.set_value<Exception>(props.flEchoDepth); break;
1280 case EAXREVERB_MODULATIONTIME: call.set_value<Exception>(props.flModulationTime); break;
1281 case EAXREVERB_MODULATIONDEPTH: call.set_value<Exception>(props.flModulationDepth); break;
1282 case EAXREVERB_AIRABSORPTIONHF: call.set_value<Exception>(props.flAirAbsorptionHF); break;
1283 case EAXREVERB_HFREFERENCE: call.set_value<Exception>(props.flHFReference); break;
1284 case EAXREVERB_LFREFERENCE: call.set_value<Exception>(props.flLFReference); break;
1285 case EAXREVERB_ROOMROLLOFFFACTOR: call.set_value<Exception>(props.flRoomRolloffFactor); break;
1286 case EAXREVERB_FLAGS: call.set_value<Exception>(props.ulFlags); break;
1287 default: fail_unknown_property_id();
1291 void EaxReverbCommitter::Get(const EaxCall &call, const EaxEffectProps &props)
1293 Get(call, props.mReverb);
1297 void EaxReverbCommitter::Set(const EaxCall &call, EAX_REVERBPROPERTIES &props)
1299 switch(call.get_property_id())
1301 case DSPROPERTY_EAX_ALL: defer<AllValidator1>(call, props); break;
1302 case DSPROPERTY_EAX_ENVIRONMENT: defer<EnvironmentValidator1>(call, props.environment); break;
1303 case DSPROPERTY_EAX_VOLUME: defer<VolumeValidator>(call, props.fVolume); break;
1304 case DSPROPERTY_EAX_DECAYTIME: defer<DecayTimeValidator>(call, props.fDecayTime_sec); break;
1305 case DSPROPERTY_EAX_DAMPING: defer<DampingValidator>(call, props.fDamping); break;
1306 default: fail_unknown_property_id();
1310 void EaxReverbCommitter::Set(const EaxCall &call, EAX20LISTENERPROPERTIES &props)
1312 switch(call.get_property_id())
1314 case DSPROPERTY_EAX20LISTENER_NONE:
1317 case DSPROPERTY_EAX20LISTENER_ALLPARAMETERS:
1318 defer<AllValidator2>(call, props);
1321 case DSPROPERTY_EAX20LISTENER_ROOM:
1322 defer<RoomValidator>(call, props.lRoom);
1325 case DSPROPERTY_EAX20LISTENER_ROOMHF:
1326 defer<RoomHFValidator>(call, props.lRoomHF);
1329 case DSPROPERTY_EAX20LISTENER_ROOMROLLOFFFACTOR:
1330 defer<RoomRolloffFactorValidator>(call, props.flRoomRolloffFactor);
1333 case DSPROPERTY_EAX20LISTENER_DECAYTIME:
1334 defer<DecayTimeValidator>(call, props.flDecayTime);
1337 case DSPROPERTY_EAX20LISTENER_DECAYHFRATIO:
1338 defer<DecayHFRatioValidator>(call, props.flDecayHFRatio);
1341 case DSPROPERTY_EAX20LISTENER_REFLECTIONS:
1342 defer<ReflectionsValidator>(call, props.lReflections);
1345 case DSPROPERTY_EAX20LISTENER_REFLECTIONSDELAY:
1346 defer<ReflectionsDelayValidator>(call, props.flReverbDelay);
1349 case DSPROPERTY_EAX20LISTENER_REVERB:
1350 defer<ReverbValidator>(call, props.lReverb);
1353 case DSPROPERTY_EAX20LISTENER_REVERBDELAY:
1354 defer<ReverbDelayValidator>(call, props.flReverbDelay);
1357 case DSPROPERTY_EAX20LISTENER_ENVIRONMENT:
1358 defer<EnvironmentValidator1, EnvironmentDeferrer2>(call, props, props.dwEnvironment);
1361 case DSPROPERTY_EAX20LISTENER_ENVIRONMENTSIZE:
1362 defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer2>(call, props, props.flEnvironmentSize);
1365 case DSPROPERTY_EAX20LISTENER_ENVIRONMENTDIFFUSION:
1366 defer<EnvironmentDiffusionValidator>(call, props.flEnvironmentDiffusion);
1369 case DSPROPERTY_EAX20LISTENER_AIRABSORPTIONHF:
1370 defer<AirAbsorptionHFValidator>(call, props.flAirAbsorptionHF);
1373 case DSPROPERTY_EAX20LISTENER_FLAGS:
1374 defer<FlagsValidator2>(call, props.dwFlags);
1378 fail_unknown_property_id();
1382 void EaxReverbCommitter::Set(const EaxCall &call, EAXREVERBPROPERTIES &props)
1384 switch(call.get_property_id())
1386 case EAXREVERB_NONE:
1389 case EAXREVERB_ALLPARAMETERS:
1390 defer<AllValidator3>(call, props);
1393 case EAXREVERB_ENVIRONMENT:
1394 defer<EnvironmentValidator3, EnvironmentDeferrer3>(call, props, props.ulEnvironment);
1397 case EAXREVERB_ENVIRONMENTSIZE:
1398 defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer3>(call, props, props.flEnvironmentSize);
1401 case EAXREVERB_ENVIRONMENTDIFFUSION:
1402 defer3<EnvironmentDiffusionValidator>(call, props, props.flEnvironmentDiffusion);
1405 case EAXREVERB_ROOM:
1406 defer3<RoomValidator>(call, props, props.lRoom);
1409 case EAXREVERB_ROOMHF:
1410 defer3<RoomHFValidator>(call, props, props.lRoomHF);
1413 case EAXREVERB_ROOMLF:
1414 defer3<RoomLFValidator>(call, props, props.lRoomLF);
1417 case EAXREVERB_DECAYTIME:
1418 defer3<DecayTimeValidator>(call, props, props.flDecayTime);
1421 case EAXREVERB_DECAYHFRATIO:
1422 defer3<DecayHFRatioValidator>(call, props, props.flDecayHFRatio);
1425 case EAXREVERB_DECAYLFRATIO:
1426 defer3<DecayLFRatioValidator>(call, props, props.flDecayLFRatio);
1429 case EAXREVERB_REFLECTIONS:
1430 defer3<ReflectionsValidator>(call, props, props.lReflections);
1433 case EAXREVERB_REFLECTIONSDELAY:
1434 defer3<ReflectionsDelayValidator>(call, props, props.flReflectionsDelay);
1437 case EAXREVERB_REFLECTIONSPAN:
1438 defer3<VectorValidator>(call, props, props.vReflectionsPan);
1441 case EAXREVERB_REVERB:
1442 defer3<ReverbValidator>(call, props, props.lReverb);
1445 case EAXREVERB_REVERBDELAY:
1446 defer3<ReverbDelayValidator>(call, props, props.flReverbDelay);
1449 case EAXREVERB_REVERBPAN:
1450 defer3<VectorValidator>(call, props, props.vReverbPan);
1453 case EAXREVERB_ECHOTIME:
1454 defer3<EchoTimeValidator>(call, props, props.flEchoTime);
1457 case EAXREVERB_ECHODEPTH:
1458 defer3<EchoDepthValidator>(call, props, props.flEchoDepth);
1461 case EAXREVERB_MODULATIONTIME:
1462 defer3<ModulationTimeValidator>(call, props, props.flModulationTime);
1465 case EAXREVERB_MODULATIONDEPTH:
1466 defer3<ModulationDepthValidator>(call, props, props.flModulationDepth);
1469 case EAXREVERB_AIRABSORPTIONHF:
1470 defer3<AirAbsorptionHFValidator>(call, props, props.flAirAbsorptionHF);
1473 case EAXREVERB_HFREFERENCE:
1474 defer3<HFReferenceValidator>(call, props, props.flHFReference);
1477 case EAXREVERB_LFREFERENCE:
1478 defer3<LFReferenceValidator>(call, props, props.flLFReference);
1481 case EAXREVERB_ROOMROLLOFFFACTOR:
1482 defer3<RoomRolloffFactorValidator>(call, props, props.flRoomRolloffFactor);
1485 case EAXREVERB_FLAGS:
1486 defer3<FlagsValidator3>(call, props, props.ulFlags);
1490 fail_unknown_property_id();
1494 void EaxReverbCommitter::Set(const EaxCall &call, EaxEffectProps &props)
1496 Set(call, props.mReverb);
1499 #endif // ALSOFT_EAX