aboutsummaryrefslogtreecommitdiffstats
path: root/al/effects/reverb.cpp
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
committerSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
commitec98cdacc85ff0202852472c7756586437912f22 (patch)
tree42414746a27ab35cb8cdbc95af521d74821e57f4 /al/effects/reverb.cpp
parentfd5269bec9a5fe4815974b1786a037e6a247bfd2 (diff)
parentb82cd2e60edb8fbe5fdd3567105ae76a016a554c (diff)
Merge remote-tracking branch 'upstream/master'HEADmaster
Diffstat (limited to 'al/effects/reverb.cpp')
-rw-r--r--al/effects/reverb.cpp834
1 files changed, 301 insertions, 533 deletions
diff --git a/al/effects/reverb.cpp b/al/effects/reverb.cpp
index b037443f..f0df51b2 100644
--- a/al/effects/reverb.cpp
+++ b/al/effects/reverb.cpp
@@ -20,14 +20,80 @@
namespace {
-void Reverb_setParami(EffectProps *props, ALenum param, int val)
+EffectProps genDefaultProps() noexcept
+{
+ ReverbProps props{};
+ props.Density = AL_EAXREVERB_DEFAULT_DENSITY;
+ props.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION;
+ props.Gain = AL_EAXREVERB_DEFAULT_GAIN;
+ props.GainHF = AL_EAXREVERB_DEFAULT_GAINHF;
+ props.GainLF = AL_EAXREVERB_DEFAULT_GAINLF;
+ props.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME;
+ props.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO;
+ props.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO;
+ props.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN;
+ props.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY;
+ props.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
+ props.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
+ props.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
+ props.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN;
+ props.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY;
+ props.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
+ props.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
+ props.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
+ props.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME;
+ props.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH;
+ props.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME;
+ props.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH;
+ props.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
+ props.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE;
+ props.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE;
+ props.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
+ props.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT;
+ return props;
+}
+
+EffectProps genDefaultStdProps() noexcept
+{
+ ReverbProps props{};
+ props.Density = AL_REVERB_DEFAULT_DENSITY;
+ props.Diffusion = AL_REVERB_DEFAULT_DIFFUSION;
+ props.Gain = AL_REVERB_DEFAULT_GAIN;
+ props.GainHF = AL_REVERB_DEFAULT_GAINHF;
+ props.GainLF = 1.0f;
+ props.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME;
+ props.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO;
+ props.DecayLFRatio = 1.0f;
+ props.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN;
+ props.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY;
+ props.ReflectionsPan = {0.0f, 0.0f, 0.0f};
+ props.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN;
+ props.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY;
+ props.LateReverbPan = {0.0f, 0.0f, 0.0f};
+ props.EchoTime = 0.25f;
+ props.EchoDepth = 0.0f;
+ props.ModulationTime = 0.25f;
+ props.ModulationDepth = 0.0f;
+ props.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
+ props.HFReference = 5000.0f;
+ props.LFReference = 250.0f;
+ props.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
+ props.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT;
+ return props;
+}
+
+} // namespace
+
+const EffectProps ReverbEffectProps{genDefaultProps()};
+
+void EffectHandler::SetParami(ReverbProps &props, ALenum param, int val)
{
switch(param)
{
case AL_EAXREVERB_DECAY_HFLIMIT:
if(!(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hflimit out of range"};
- props->Reverb.DecayHFLimit = val != AL_FALSE;
+ props.DecayHFLimit = val != AL_FALSE;
break;
default:
@@ -35,167 +101,167 @@ void Reverb_setParami(EffectProps *props, ALenum param, int val)
param};
}
}
-void Reverb_setParamiv(EffectProps *props, ALenum param, const int *vals)
-{ Reverb_setParami(props, param, vals[0]); }
-void Reverb_setParamf(EffectProps *props, ALenum param, float val)
+void EffectHandler::SetParamiv(ReverbProps &props, ALenum param, const int *vals)
+{ SetParami(props, param, vals[0]); }
+void EffectHandler::SetParamf(ReverbProps &props, ALenum param, float val)
{
switch(param)
{
case AL_EAXREVERB_DENSITY:
if(!(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb density out of range"};
- props->Reverb.Density = val;
+ props.Density = val;
break;
case AL_EAXREVERB_DIFFUSION:
if(!(val >= AL_EAXREVERB_MIN_DIFFUSION && val <= AL_EAXREVERB_MAX_DIFFUSION))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb diffusion out of range"};
- props->Reverb.Diffusion = val;
+ props.Diffusion = val;
break;
case AL_EAXREVERB_GAIN:
if(!(val >= AL_EAXREVERB_MIN_GAIN && val <= AL_EAXREVERB_MAX_GAIN))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gain out of range"};
- props->Reverb.Gain = val;
+ props.Gain = val;
break;
case AL_EAXREVERB_GAINHF:
if(!(val >= AL_EAXREVERB_MIN_GAINHF && val <= AL_EAXREVERB_MAX_GAINHF))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gainhf out of range"};
- props->Reverb.GainHF = val;
+ props.GainHF = val;
break;
case AL_EAXREVERB_GAINLF:
if(!(val >= AL_EAXREVERB_MIN_GAINLF && val <= AL_EAXREVERB_MAX_GAINLF))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gainlf out of range"};
- props->Reverb.GainLF = val;
+ props.GainLF = val;
break;
case AL_EAXREVERB_DECAY_TIME:
if(!(val >= AL_EAXREVERB_MIN_DECAY_TIME && val <= AL_EAXREVERB_MAX_DECAY_TIME))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay time out of range"};
- props->Reverb.DecayTime = val;
+ props.DecayTime = val;
break;
case AL_EAXREVERB_DECAY_HFRATIO:
if(!(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO && val <= AL_EAXREVERB_MAX_DECAY_HFRATIO))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hfratio out of range"};
- props->Reverb.DecayHFRatio = val;
+ props.DecayHFRatio = val;
break;
case AL_EAXREVERB_DECAY_LFRATIO:
if(!(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO && val <= AL_EAXREVERB_MAX_DECAY_LFRATIO))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay lfratio out of range"};
- props->Reverb.DecayLFRatio = val;
+ props.DecayLFRatio = val;
break;
case AL_EAXREVERB_REFLECTIONS_GAIN:
if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections gain out of range"};
- props->Reverb.ReflectionsGain = val;
+ props.ReflectionsGain = val;
break;
case AL_EAXREVERB_REFLECTIONS_DELAY:
if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections delay out of range"};
- props->Reverb.ReflectionsDelay = val;
+ props.ReflectionsDelay = val;
break;
case AL_EAXREVERB_LATE_REVERB_GAIN:
if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb gain out of range"};
- props->Reverb.LateReverbGain = val;
+ props.LateReverbGain = val;
break;
case AL_EAXREVERB_LATE_REVERB_DELAY:
if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb delay out of range"};
- props->Reverb.LateReverbDelay = val;
+ props.LateReverbDelay = val;
break;
case AL_EAXREVERB_ECHO_TIME:
if(!(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb echo time out of range"};
- props->Reverb.EchoTime = val;
+ props.EchoTime = val;
break;
case AL_EAXREVERB_ECHO_DEPTH:
if(!(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb echo depth out of range"};
- props->Reverb.EchoDepth = val;
+ props.EchoDepth = val;
break;
case AL_EAXREVERB_MODULATION_TIME:
if(!(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb modulation time out of range"};
- props->Reverb.ModulationTime = val;
+ props.ModulationTime = val;
break;
case AL_EAXREVERB_MODULATION_DEPTH:
if(!(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb modulation depth out of range"};
- props->Reverb.ModulationDepth = val;
+ props.ModulationDepth = val;
break;
case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
if(!(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb air absorption gainhf out of range"};
- props->Reverb.AirAbsorptionGainHF = val;
+ props.AirAbsorptionGainHF = val;
break;
case AL_EAXREVERB_HFREFERENCE:
if(!(val >= AL_EAXREVERB_MIN_HFREFERENCE && val <= AL_EAXREVERB_MAX_HFREFERENCE))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb hfreference out of range"};
- props->Reverb.HFReference = val;
+ props.HFReference = val;
break;
case AL_EAXREVERB_LFREFERENCE:
if(!(val >= AL_EAXREVERB_MIN_LFREFERENCE && val <= AL_EAXREVERB_MAX_LFREFERENCE))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb lfreference out of range"};
- props->Reverb.LFReference = val;
+ props.LFReference = val;
break;
case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
if(!(val >= AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb room rolloff factor out of range"};
- props->Reverb.RoomRolloffFactor = val;
+ props.RoomRolloffFactor = val;
break;
default:
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
}
}
-void Reverb_setParamfv(EffectProps *props, ALenum param, const float *vals)
+void EffectHandler::SetParamfv(ReverbProps &props, ALenum param, const float *vals)
{
switch(param)
{
case AL_EAXREVERB_REFLECTIONS_PAN:
if(!(std::isfinite(vals[0]) && std::isfinite(vals[1]) && std::isfinite(vals[2])))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections pan out of range"};
- props->Reverb.ReflectionsPan[0] = vals[0];
- props->Reverb.ReflectionsPan[1] = vals[1];
- props->Reverb.ReflectionsPan[2] = vals[2];
+ props.ReflectionsPan[0] = vals[0];
+ props.ReflectionsPan[1] = vals[1];
+ props.ReflectionsPan[2] = vals[2];
break;
case AL_EAXREVERB_LATE_REVERB_PAN:
if(!(std::isfinite(vals[0]) && std::isfinite(vals[1]) && std::isfinite(vals[2])))
throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb pan out of range"};
- props->Reverb.LateReverbPan[0] = vals[0];
- props->Reverb.LateReverbPan[1] = vals[1];
- props->Reverb.LateReverbPan[2] = vals[2];
+ props.LateReverbPan[0] = vals[0];
+ props.LateReverbPan[1] = vals[1];
+ props.LateReverbPan[2] = vals[2];
break;
default:
- Reverb_setParamf(props, param, vals[0]);
+ SetParamf(props, param, vals[0]);
break;
}
}
-void Reverb_getParami(const EffectProps *props, ALenum param, int *val)
+void EffectHandler::GetParami(const ReverbProps &props, ALenum param, int *val)
{
switch(param)
{
case AL_EAXREVERB_DECAY_HFLIMIT:
- *val = props->Reverb.DecayHFLimit;
+ *val = props.DecayHFLimit;
break;
default:
@@ -203,365 +269,214 @@ void Reverb_getParami(const EffectProps *props, ALenum param, int *val)
param};
}
}
-void Reverb_getParamiv(const EffectProps *props, ALenum param, int *vals)
-{ Reverb_getParami(props, param, vals); }
-void Reverb_getParamf(const EffectProps *props, ALenum param, float *val)
+void EffectHandler::GetParamiv(const ReverbProps &props, ALenum param, int *vals)
+{ GetParami(props, param, vals); }
+void EffectHandler::GetParamf(const ReverbProps &props, ALenum param, float *val)
{
switch(param)
{
- case AL_EAXREVERB_DENSITY:
- *val = props->Reverb.Density;
- break;
-
- case AL_EAXREVERB_DIFFUSION:
- *val = props->Reverb.Diffusion;
- break;
-
- case AL_EAXREVERB_GAIN:
- *val = props->Reverb.Gain;
- break;
-
- case AL_EAXREVERB_GAINHF:
- *val = props->Reverb.GainHF;
- break;
-
- case AL_EAXREVERB_GAINLF:
- *val = props->Reverb.GainLF;
- break;
-
- case AL_EAXREVERB_DECAY_TIME:
- *val = props->Reverb.DecayTime;
- break;
-
- case AL_EAXREVERB_DECAY_HFRATIO:
- *val = props->Reverb.DecayHFRatio;
- break;
-
- case AL_EAXREVERB_DECAY_LFRATIO:
- *val = props->Reverb.DecayLFRatio;
- break;
-
- case AL_EAXREVERB_REFLECTIONS_GAIN:
- *val = props->Reverb.ReflectionsGain;
- break;
-
- case AL_EAXREVERB_REFLECTIONS_DELAY:
- *val = props->Reverb.ReflectionsDelay;
- break;
-
- case AL_EAXREVERB_LATE_REVERB_GAIN:
- *val = props->Reverb.LateReverbGain;
- break;
-
- case AL_EAXREVERB_LATE_REVERB_DELAY:
- *val = props->Reverb.LateReverbDelay;
- break;
-
- case AL_EAXREVERB_ECHO_TIME:
- *val = props->Reverb.EchoTime;
- break;
-
- case AL_EAXREVERB_ECHO_DEPTH:
- *val = props->Reverb.EchoDepth;
- break;
-
- case AL_EAXREVERB_MODULATION_TIME:
- *val = props->Reverb.ModulationTime;
- break;
-
- case AL_EAXREVERB_MODULATION_DEPTH:
- *val = props->Reverb.ModulationDepth;
- break;
-
- case AL_EAXREVERB_AIR_ABSORPTION_GAINHF:
- *val = props->Reverb.AirAbsorptionGainHF;
- break;
-
- case AL_EAXREVERB_HFREFERENCE:
- *val = props->Reverb.HFReference;
- break;
-
- case AL_EAXREVERB_LFREFERENCE:
- *val = props->Reverb.LFReference;
- break;
-
- case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR:
- *val = props->Reverb.RoomRolloffFactor;
- break;
+ case AL_EAXREVERB_DENSITY: *val = props.Density; break;
+ case AL_EAXREVERB_DIFFUSION: *val = props.Diffusion; break;
+ case AL_EAXREVERB_GAIN: *val = props.Gain; break;
+ case AL_EAXREVERB_GAINHF: *val = props.GainHF; break;
+ case AL_EAXREVERB_GAINLF: *val = props.GainLF; break;
+ case AL_EAXREVERB_DECAY_TIME: *val = props.DecayTime; break;
+ case AL_EAXREVERB_DECAY_HFRATIO: *val = props.DecayHFRatio; break;
+ case AL_EAXREVERB_DECAY_LFRATIO: *val = props.DecayLFRatio; break;
+ case AL_EAXREVERB_REFLECTIONS_GAIN: *val = props.ReflectionsGain; break;
+ case AL_EAXREVERB_REFLECTIONS_DELAY: *val = props.ReflectionsDelay; break;
+ case AL_EAXREVERB_LATE_REVERB_GAIN: *val = props.LateReverbGain; break;
+ case AL_EAXREVERB_LATE_REVERB_DELAY: *val = props.LateReverbDelay; break;
+ case AL_EAXREVERB_ECHO_TIME: *val = props.EchoTime; break;
+ case AL_EAXREVERB_ECHO_DEPTH: *val = props.EchoDepth; break;
+ case AL_EAXREVERB_MODULATION_TIME: *val = props.ModulationTime; break;
+ case AL_EAXREVERB_MODULATION_DEPTH: *val = props.ModulationDepth; break;
+ case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: *val = props.AirAbsorptionGainHF; break;
+ case AL_EAXREVERB_HFREFERENCE: *val = props.HFReference; break;
+ case AL_EAXREVERB_LFREFERENCE: *val = props.LFReference; break;
+ case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: *val = props.RoomRolloffFactor; break;
default:
throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
}
}
-void Reverb_getParamfv(const EffectProps *props, ALenum param, float *vals)
+void EffectHandler::GetParamfv(const ReverbProps &props, ALenum param, float *vals)
{
switch(param)
{
case AL_EAXREVERB_REFLECTIONS_PAN:
- vals[0] = props->Reverb.ReflectionsPan[0];
- vals[1] = props->Reverb.ReflectionsPan[1];
- vals[2] = props->Reverb.ReflectionsPan[2];
+ vals[0] = props.ReflectionsPan[0];
+ vals[1] = props.ReflectionsPan[1];
+ vals[2] = props.ReflectionsPan[2];
break;
case AL_EAXREVERB_LATE_REVERB_PAN:
- vals[0] = props->Reverb.LateReverbPan[0];
- vals[1] = props->Reverb.LateReverbPan[1];
- vals[2] = props->Reverb.LateReverbPan[2];
+ vals[0] = props.LateReverbPan[0];
+ vals[1] = props.LateReverbPan[1];
+ vals[2] = props.LateReverbPan[2];
break;
default:
- Reverb_getParamf(props, param, vals);
+ GetParamf(props, param, vals);
break;
}
}
-EffectProps genDefaultProps() noexcept
-{
- EffectProps props{};
- props.Reverb.Density = AL_EAXREVERB_DEFAULT_DENSITY;
- props.Reverb.Diffusion = AL_EAXREVERB_DEFAULT_DIFFUSION;
- props.Reverb.Gain = AL_EAXREVERB_DEFAULT_GAIN;
- props.Reverb.GainHF = AL_EAXREVERB_DEFAULT_GAINHF;
- props.Reverb.GainLF = AL_EAXREVERB_DEFAULT_GAINLF;
- props.Reverb.DecayTime = AL_EAXREVERB_DEFAULT_DECAY_TIME;
- props.Reverb.DecayHFRatio = AL_EAXREVERB_DEFAULT_DECAY_HFRATIO;
- props.Reverb.DecayLFRatio = AL_EAXREVERB_DEFAULT_DECAY_LFRATIO;
- props.Reverb.ReflectionsGain = AL_EAXREVERB_DEFAULT_REFLECTIONS_GAIN;
- props.Reverb.ReflectionsDelay = AL_EAXREVERB_DEFAULT_REFLECTIONS_DELAY;
- props.Reverb.ReflectionsPan[0] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
- props.Reverb.ReflectionsPan[1] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
- props.Reverb.ReflectionsPan[2] = AL_EAXREVERB_DEFAULT_REFLECTIONS_PAN_XYZ;
- props.Reverb.LateReverbGain = AL_EAXREVERB_DEFAULT_LATE_REVERB_GAIN;
- props.Reverb.LateReverbDelay = AL_EAXREVERB_DEFAULT_LATE_REVERB_DELAY;
- props.Reverb.LateReverbPan[0] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
- props.Reverb.LateReverbPan[1] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
- props.Reverb.LateReverbPan[2] = AL_EAXREVERB_DEFAULT_LATE_REVERB_PAN_XYZ;
- props.Reverb.EchoTime = AL_EAXREVERB_DEFAULT_ECHO_TIME;
- props.Reverb.EchoDepth = AL_EAXREVERB_DEFAULT_ECHO_DEPTH;
- props.Reverb.ModulationTime = AL_EAXREVERB_DEFAULT_MODULATION_TIME;
- props.Reverb.ModulationDepth = AL_EAXREVERB_DEFAULT_MODULATION_DEPTH;
- props.Reverb.AirAbsorptionGainHF = AL_EAXREVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
- props.Reverb.HFReference = AL_EAXREVERB_DEFAULT_HFREFERENCE;
- props.Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE;
- props.Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
- props.Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT;
- return props;
-}
+const EffectProps StdReverbEffectProps{genDefaultStdProps()};
-void StdReverb_setParami(EffectProps *props, ALenum param, int val)
+void EffectHandler::StdReverbSetParami(ReverbProps &props, ALenum param, int val)
{
switch(param)
{
case AL_REVERB_DECAY_HFLIMIT:
if(!(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT))
- throw effect_exception{AL_INVALID_VALUE, "Reverb decay hflimit out of range"};
- props->Reverb.DecayHFLimit = val != AL_FALSE;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hflimit out of range"};
+ props.DecayHFLimit = val != AL_FALSE;
break;
default:
- throw effect_exception{AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param};
+ throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
+ param};
}
}
-void StdReverb_setParamiv(EffectProps *props, ALenum param, const int *vals)
-{ StdReverb_setParami(props, param, vals[0]); }
-void StdReverb_setParamf(EffectProps *props, ALenum param, float val)
+void EffectHandler::StdReverbSetParamiv(ReverbProps &props, ALenum param, const int *vals)
+{ StdReverbSetParami(props, param, vals[0]); }
+void EffectHandler::StdReverbSetParamf(ReverbProps &props, ALenum param, float val)
{
switch(param)
{
case AL_REVERB_DENSITY:
if(!(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY))
- throw effect_exception{AL_INVALID_VALUE, "Reverb density out of range"};
- props->Reverb.Density = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb density out of range"};
+ props.Density = val;
break;
case AL_REVERB_DIFFUSION:
if(!(val >= AL_REVERB_MIN_DIFFUSION && val <= AL_REVERB_MAX_DIFFUSION))
- throw effect_exception{AL_INVALID_VALUE, "Reverb diffusion out of range"};
- props->Reverb.Diffusion = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb diffusion out of range"};
+ props.Diffusion = val;
break;
case AL_REVERB_GAIN:
if(!(val >= AL_REVERB_MIN_GAIN && val <= AL_REVERB_MAX_GAIN))
- throw effect_exception{AL_INVALID_VALUE, "Reverb gain out of range"};
- props->Reverb.Gain = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gain out of range"};
+ props.Gain = val;
break;
case AL_REVERB_GAINHF:
if(!(val >= AL_REVERB_MIN_GAINHF && val <= AL_REVERB_MAX_GAINHF))
- throw effect_exception{AL_INVALID_VALUE, "Reverb gainhf out of range"};
- props->Reverb.GainHF = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb gainhf out of range"};
+ props.GainHF = val;
break;
case AL_REVERB_DECAY_TIME:
if(!(val >= AL_REVERB_MIN_DECAY_TIME && val <= AL_REVERB_MAX_DECAY_TIME))
- throw effect_exception{AL_INVALID_VALUE, "Reverb decay time out of range"};
- props->Reverb.DecayTime = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay time out of range"};
+ props.DecayTime = val;
break;
case AL_REVERB_DECAY_HFRATIO:
if(!(val >= AL_REVERB_MIN_DECAY_HFRATIO && val <= AL_REVERB_MAX_DECAY_HFRATIO))
- throw effect_exception{AL_INVALID_VALUE, "Reverb decay hfratio out of range"};
- props->Reverb.DecayHFRatio = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb decay hfratio out of range"};
+ props.DecayHFRatio = val;
break;
case AL_REVERB_REFLECTIONS_GAIN:
if(!(val >= AL_REVERB_MIN_REFLECTIONS_GAIN && val <= AL_REVERB_MAX_REFLECTIONS_GAIN))
- throw effect_exception{AL_INVALID_VALUE, "Reverb reflections gain out of range"};
- props->Reverb.ReflectionsGain = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections gain out of range"};
+ props.ReflectionsGain = val;
break;
case AL_REVERB_REFLECTIONS_DELAY:
if(!(val >= AL_REVERB_MIN_REFLECTIONS_DELAY && val <= AL_REVERB_MAX_REFLECTIONS_DELAY))
- throw effect_exception{AL_INVALID_VALUE, "Reverb reflections delay out of range"};
- props->Reverb.ReflectionsDelay = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb reflections delay out of range"};
+ props.ReflectionsDelay = val;
break;
case AL_REVERB_LATE_REVERB_GAIN:
if(!(val >= AL_REVERB_MIN_LATE_REVERB_GAIN && val <= AL_REVERB_MAX_LATE_REVERB_GAIN))
- throw effect_exception{AL_INVALID_VALUE, "Reverb late reverb gain out of range"};
- props->Reverb.LateReverbGain = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb gain out of range"};
+ props.LateReverbGain = val;
break;
case AL_REVERB_LATE_REVERB_DELAY:
if(!(val >= AL_REVERB_MIN_LATE_REVERB_DELAY && val <= AL_REVERB_MAX_LATE_REVERB_DELAY))
- throw effect_exception{AL_INVALID_VALUE, "Reverb late reverb delay out of range"};
- props->Reverb.LateReverbDelay = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb late reverb delay out of range"};
+ props.LateReverbDelay = val;
break;
case AL_REVERB_AIR_ABSORPTION_GAINHF:
if(!(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF))
- throw effect_exception{AL_INVALID_VALUE, "Reverb air absorption gainhf out of range"};
- props->Reverb.AirAbsorptionGainHF = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb air absorption gainhf out of range"};
+ props.AirAbsorptionGainHF = val;
break;
case AL_REVERB_ROOM_ROLLOFF_FACTOR:
if(!(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR))
- throw effect_exception{AL_INVALID_VALUE, "Reverb room rolloff factor out of range"};
- props->Reverb.RoomRolloffFactor = val;
+ throw effect_exception{AL_INVALID_VALUE, "EAX Reverb room rolloff factor out of range"};
+ props.RoomRolloffFactor = val;
break;
default:
- throw effect_exception{AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param};
+ throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
+ }
+}
+void EffectHandler::StdReverbSetParamfv(ReverbProps &props, ALenum param, const float *vals)
+{
+ switch(param)
+ {
+ default:
+ StdReverbSetParamf(props, param, vals[0]);
+ break;
}
}
-void StdReverb_setParamfv(EffectProps *props, ALenum param, const float *vals)
-{ StdReverb_setParamf(props, param, vals[0]); }
-void StdReverb_getParami(const EffectProps *props, ALenum param, int *val)
+void EffectHandler::StdReverbGetParami(const ReverbProps &props, ALenum param, int *val)
{
switch(param)
{
case AL_REVERB_DECAY_HFLIMIT:
- *val = props->Reverb.DecayHFLimit;
+ *val = props.DecayHFLimit;
break;
default:
- throw effect_exception{AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param};
+ throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x",
+ param};
}
}
-void StdReverb_getParamiv(const EffectProps *props, ALenum param, int *vals)
-{ StdReverb_getParami(props, param, vals); }
-void StdReverb_getParamf(const EffectProps *props, ALenum param, float *val)
+void EffectHandler::StdReverbGetParamiv(const ReverbProps &props, ALenum param, int *vals)
+{ StdReverbGetParami(props, param, vals); }
+void EffectHandler::StdReverbGetParamf(const ReverbProps &props, ALenum param, float *val)
{
switch(param)
{
- case AL_REVERB_DENSITY:
- *val = props->Reverb.Density;
- break;
-
- case AL_REVERB_DIFFUSION:
- *val = props->Reverb.Diffusion;
- break;
-
- case AL_REVERB_GAIN:
- *val = props->Reverb.Gain;
- break;
-
- case AL_REVERB_GAINHF:
- *val = props->Reverb.GainHF;
- break;
-
- case AL_REVERB_DECAY_TIME:
- *val = props->Reverb.DecayTime;
- break;
-
- case AL_REVERB_DECAY_HFRATIO:
- *val = props->Reverb.DecayHFRatio;
- break;
-
- case AL_REVERB_REFLECTIONS_GAIN:
- *val = props->Reverb.ReflectionsGain;
- break;
-
- case AL_REVERB_REFLECTIONS_DELAY:
- *val = props->Reverb.ReflectionsDelay;
- break;
-
- case AL_REVERB_LATE_REVERB_GAIN:
- *val = props->Reverb.LateReverbGain;
- break;
-
- case AL_REVERB_LATE_REVERB_DELAY:
- *val = props->Reverb.LateReverbDelay;
- break;
-
- case AL_REVERB_AIR_ABSORPTION_GAINHF:
- *val = props->Reverb.AirAbsorptionGainHF;
- break;
-
- case AL_REVERB_ROOM_ROLLOFF_FACTOR:
- *val = props->Reverb.RoomRolloffFactor;
- break;
+ case AL_REVERB_DENSITY: *val = props.Density; break;
+ case AL_REVERB_DIFFUSION: *val = props.Diffusion; break;
+ case AL_REVERB_GAIN: *val = props.Gain; break;
+ case AL_REVERB_GAINHF: *val = props.GainHF; break;
+ case AL_REVERB_DECAY_TIME: *val = props.DecayTime; break;
+ case AL_REVERB_DECAY_HFRATIO: *val = props.DecayHFRatio; break;
+ case AL_REVERB_REFLECTIONS_GAIN: *val = props.ReflectionsGain; break;
+ case AL_REVERB_REFLECTIONS_DELAY: *val = props.ReflectionsDelay; break;
+ case AL_REVERB_LATE_REVERB_GAIN: *val = props.LateReverbGain; break;
+ case AL_REVERB_LATE_REVERB_DELAY: *val = props.LateReverbDelay; break;
+ case AL_REVERB_AIR_ABSORPTION_GAINHF: *val = props.AirAbsorptionGainHF; break;
+ case AL_REVERB_ROOM_ROLLOFF_FACTOR: *val = props.RoomRolloffFactor; break;
default:
- throw effect_exception{AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param};
+ throw effect_exception{AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", param};
}
}
-void StdReverb_getParamfv(const EffectProps *props, ALenum param, float *vals)
-{ StdReverb_getParamf(props, param, vals); }
-
-EffectProps genDefaultStdProps() noexcept
+void EffectHandler::StdReverbGetParamfv(const ReverbProps &props, ALenum param, float *vals)
{
- EffectProps props{};
- props.Reverb.Density = AL_REVERB_DEFAULT_DENSITY;
- props.Reverb.Diffusion = AL_REVERB_DEFAULT_DIFFUSION;
- props.Reverb.Gain = AL_REVERB_DEFAULT_GAIN;
- props.Reverb.GainHF = AL_REVERB_DEFAULT_GAINHF;
- props.Reverb.GainLF = 1.0f;
- props.Reverb.DecayTime = AL_REVERB_DEFAULT_DECAY_TIME;
- props.Reverb.DecayHFRatio = AL_REVERB_DEFAULT_DECAY_HFRATIO;
- props.Reverb.DecayLFRatio = 1.0f;
- props.Reverb.ReflectionsGain = AL_REVERB_DEFAULT_REFLECTIONS_GAIN;
- props.Reverb.ReflectionsDelay = AL_REVERB_DEFAULT_REFLECTIONS_DELAY;
- props.Reverb.ReflectionsPan[0] = 0.0f;
- props.Reverb.ReflectionsPan[1] = 0.0f;
- props.Reverb.ReflectionsPan[2] = 0.0f;
- props.Reverb.LateReverbGain = AL_REVERB_DEFAULT_LATE_REVERB_GAIN;
- props.Reverb.LateReverbDelay = AL_REVERB_DEFAULT_LATE_REVERB_DELAY;
- props.Reverb.LateReverbPan[0] = 0.0f;
- props.Reverb.LateReverbPan[1] = 0.0f;
- props.Reverb.LateReverbPan[2] = 0.0f;
- props.Reverb.EchoTime = 0.25f;
- props.Reverb.EchoDepth = 0.0f;
- props.Reverb.ModulationTime = 0.25f;
- props.Reverb.ModulationDepth = 0.0f;
- props.Reverb.AirAbsorptionGainHF = AL_REVERB_DEFAULT_AIR_ABSORPTION_GAINHF;
- props.Reverb.HFReference = 5000.0f;
- props.Reverb.LFReference = 250.0f;
- props.Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR;
- props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT;
- return props;
+ switch(param)
+ {
+ default:
+ StdReverbGetParamf(props, param, vals);
+ break;
+ }
}
-} // namespace
-
-DEFINE_ALEFFECT_VTABLE(Reverb);
-
-const EffectProps ReverbEffectProps{genDefaultProps()};
-
-DEFINE_ALEFFECT_VTABLE(StdReverb);
-
-const EffectProps StdReverbEffectProps{genDefaultStdProps()};
#ifdef ALSOFT_EAX
namespace {
@@ -1086,98 +1001,87 @@ struct EaxReverbCommitter::Exception : public EaxReverbEffectException
throw Exception{message};
}
-void EaxReverbCommitter::translate(const EAX_REVERBPROPERTIES& src, EaxEffectProps& dst) noexcept
+void EaxReverbCommitter::translate(const EAX_REVERBPROPERTIES& src, EAXREVERBPROPERTIES& dst) noexcept
{
assert(src.environment <= EAX1REVERB_MAXENVIRONMENT);
- auto&& eaxprops = dst.emplace<EAXREVERBPROPERTIES>(EAXREVERB_PRESETS[src.environment]);
- eaxprops.flDecayTime = src.fDecayTime_sec;
- eaxprops.flDecayHFRatio = src.fDamping;
- eaxprops.lReverb = mini(static_cast<int>(gain_to_level_mb(src.fVolume)), 0);
+ dst = EAXREVERB_PRESETS[src.environment];
+ dst.flDecayTime = src.fDecayTime_sec;
+ dst.flDecayHFRatio = src.fDamping;
+ dst.lReverb = mini(static_cast<int>(gain_to_level_mb(src.fVolume)), 0);
}
-void EaxReverbCommitter::translate(const EAX20LISTENERPROPERTIES& src, EaxEffectProps& dst) noexcept
+void EaxReverbCommitter::translate(const EAX20LISTENERPROPERTIES& src, EAXREVERBPROPERTIES& dst) noexcept
{
assert(src.dwEnvironment <= EAX1REVERB_MAXENVIRONMENT);
- auto&& eaxprops = dst.emplace<EAXREVERBPROPERTIES>(EAXREVERB_PRESETS[src.dwEnvironment]);
- eaxprops.ulEnvironment = src.dwEnvironment;
- eaxprops.flEnvironmentSize = src.flEnvironmentSize;
- eaxprops.flEnvironmentDiffusion = src.flEnvironmentDiffusion;
- eaxprops.lRoom = src.lRoom;
- eaxprops.lRoomHF = src.lRoomHF;
- eaxprops.flDecayTime = src.flDecayTime;
- eaxprops.flDecayHFRatio = src.flDecayHFRatio;
- eaxprops.lReflections = src.lReflections;
- eaxprops.flReflectionsDelay = src.flReflectionsDelay;
- eaxprops.lReverb = src.lReverb;
- eaxprops.flReverbDelay = src.flReverbDelay;
- eaxprops.flAirAbsorptionHF = src.flAirAbsorptionHF;
- eaxprops.flRoomRolloffFactor = src.flRoomRolloffFactor;
- eaxprops.ulFlags = src.dwFlags;
-}
-
-void EaxReverbCommitter::translate(const EAXREVERBPROPERTIES& src, EaxEffectProps& dst) noexcept
-{
- dst = src;
+ dst = EAXREVERB_PRESETS[src.dwEnvironment];
+ dst.ulEnvironment = src.dwEnvironment;
+ dst.flEnvironmentSize = src.flEnvironmentSize;
+ dst.flEnvironmentDiffusion = src.flEnvironmentDiffusion;
+ dst.lRoom = src.lRoom;
+ dst.lRoomHF = src.lRoomHF;
+ dst.flDecayTime = src.flDecayTime;
+ dst.flDecayHFRatio = src.flDecayHFRatio;
+ dst.lReflections = src.lReflections;
+ dst.flReflectionsDelay = src.flReflectionsDelay;
+ dst.lReverb = src.lReverb;
+ dst.flReverbDelay = src.flReverbDelay;
+ dst.flAirAbsorptionHF = src.flAirAbsorptionHF;
+ dst.flRoomRolloffFactor = src.flRoomRolloffFactor;
+ dst.ulFlags = src.dwFlags;
}
bool EaxReverbCommitter::commit(const EAX_REVERBPROPERTIES &props)
{
- EaxEffectProps dst{};
+ EAXREVERBPROPERTIES dst{};
translate(props, dst);
return commit(dst);
}
bool EaxReverbCommitter::commit(const EAX20LISTENERPROPERTIES &props)
{
- EaxEffectProps dst{};
+ EAXREVERBPROPERTIES dst{};
translate(props, dst);
return commit(dst);
}
bool EaxReverbCommitter::commit(const EAXREVERBPROPERTIES &props)
{
- EaxEffectProps dst{};
- translate(props, dst);
- return commit(dst);
-}
-
-bool EaxReverbCommitter::commit(const EaxEffectProps &props)
-{
- if(props == mEaxProps)
+ if(auto *cur = std::get_if<EAXREVERBPROPERTIES>(&mEaxProps); cur && *cur == props)
return false;
mEaxProps = props;
- auto &eaxprops = std::get<EAXREVERBPROPERTIES>(props);
- const auto size = eaxprops.flEnvironmentSize;
- const auto density = (size * size * size) / 16.0F;
- mAlProps.Reverb.Density = std::min(density, AL_EAXREVERB_MAX_DENSITY);
- mAlProps.Reverb.Diffusion = eaxprops.flEnvironmentDiffusion;
- mAlProps.Reverb.Gain = level_mb_to_gain(static_cast<float>(eaxprops.lRoom));
- mAlProps.Reverb.GainHF = level_mb_to_gain(static_cast<float>(eaxprops.lRoomHF));
- mAlProps.Reverb.GainLF = level_mb_to_gain(static_cast<float>(eaxprops.lRoomLF));
- mAlProps.Reverb.DecayTime = eaxprops.flDecayTime;
- mAlProps.Reverb.DecayHFRatio = eaxprops.flDecayHFRatio;
- mAlProps.Reverb.DecayLFRatio = eaxprops.flDecayLFRatio;
- mAlProps.Reverb.ReflectionsGain = level_mb_to_gain(static_cast<float>(eaxprops.lReflections));
- mAlProps.Reverb.ReflectionsDelay = eaxprops.flReflectionsDelay;
- mAlProps.Reverb.ReflectionsPan[0] = eaxprops.vReflectionsPan.x;
- mAlProps.Reverb.ReflectionsPan[1] = eaxprops.vReflectionsPan.y;
- mAlProps.Reverb.ReflectionsPan[2] = eaxprops.vReflectionsPan.z;
- mAlProps.Reverb.LateReverbGain = level_mb_to_gain(static_cast<float>(eaxprops.lReverb));
- mAlProps.Reverb.LateReverbDelay = eaxprops.flReverbDelay;
- mAlProps.Reverb.LateReverbPan[0] = eaxprops.vReverbPan.x;
- mAlProps.Reverb.LateReverbPan[1] = eaxprops.vReverbPan.y;
- mAlProps.Reverb.LateReverbPan[2] = eaxprops.vReverbPan.z;
- mAlProps.Reverb.EchoTime = eaxprops.flEchoTime;
- mAlProps.Reverb.EchoDepth = eaxprops.flEchoDepth;
- mAlProps.Reverb.ModulationTime = eaxprops.flModulationTime;
- mAlProps.Reverb.ModulationDepth = eaxprops.flModulationDepth;
- mAlProps.Reverb.AirAbsorptionGainHF = level_mb_to_gain(eaxprops.flAirAbsorptionHF);
- mAlProps.Reverb.HFReference = eaxprops.flHFReference;
- mAlProps.Reverb.LFReference = eaxprops.flLFReference;
- mAlProps.Reverb.RoomRolloffFactor = eaxprops.flRoomRolloffFactor;
- mAlProps.Reverb.DecayHFLimit = ((eaxprops.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0);
+ const auto size = props.flEnvironmentSize;
+ const auto density = (size * size * size) / 16.0f;
+ mAlProps = [&]{
+ ReverbProps ret{};
+ ret.Density = std::min(density, AL_EAXREVERB_MAX_DENSITY);
+ ret.Diffusion = props.flEnvironmentDiffusion;
+ ret.Gain = level_mb_to_gain(static_cast<float>(props.lRoom));
+ ret.GainHF = level_mb_to_gain(static_cast<float>(props.lRoomHF));
+ ret.GainLF = level_mb_to_gain(static_cast<float>(props.lRoomLF));
+ ret.DecayTime = props.flDecayTime;
+ ret.DecayHFRatio = props.flDecayHFRatio;
+ ret.DecayLFRatio = props.flDecayLFRatio;
+ ret.ReflectionsGain = level_mb_to_gain(static_cast<float>(props.lReflections));
+ ret.ReflectionsDelay = props.flReflectionsDelay;
+ ret.ReflectionsPan = {props.vReflectionsPan.x, props.vReflectionsPan.y,
+ props.vReflectionsPan.z};
+ ret.LateReverbGain = level_mb_to_gain(static_cast<float>(props.lReverb));
+ ret.LateReverbDelay = props.flReverbDelay;
+ ret.LateReverbPan = {props.vReverbPan.x, props.vReverbPan.y, props.vReverbPan.z};
+ ret.EchoTime = props.flEchoTime;
+ ret.EchoDepth = props.flEchoDepth;
+ ret.ModulationTime = props.flModulationTime;
+ ret.ModulationDepth = props.flModulationDepth;
+ ret.AirAbsorptionGainHF = level_mb_to_gain(props.flAirAbsorptionHF);
+ ret.HFReference = props.flHFReference;
+ ret.LFReference = props.flLFReference;
+ ret.RoomRolloffFactor = props.flRoomRolloffFactor;
+ ret.DecayHFLimit = ((props.ulFlags & EAXREVERBFLAGS_DECAYHFLIMIT) != 0);
+ return ret;
+ }();
+
return true;
}
@@ -1274,11 +1178,6 @@ void EaxReverbCommitter::Get(const EaxCall &call, const EAXREVERBPROPERTIES &pro
}
}
-void EaxReverbCommitter::Get(const EaxCall &call, const EaxEffectProps &props)
-{
- Get(call, std::get<EAXREVERBPROPERTIES>(props));
-}
-
void EaxReverbCommitter::Set(const EaxCall &call, EAX_REVERBPROPERTIES &props)
{
@@ -1297,71 +1196,23 @@ void EaxReverbCommitter::Set(const EaxCall &call, EAX20LISTENERPROPERTIES &props
{
switch(call.get_property_id())
{
- case DSPROPERTY_EAX20LISTENER_NONE:
- break;
-
- case DSPROPERTY_EAX20LISTENER_ALLPARAMETERS:
- defer<AllValidator2>(call, props);
- break;
-
- case DSPROPERTY_EAX20LISTENER_ROOM:
- defer<RoomValidator>(call, props.lRoom);
- break;
-
- case DSPROPERTY_EAX20LISTENER_ROOMHF:
- defer<RoomHFValidator>(call, props.lRoomHF);
- break;
-
- case DSPROPERTY_EAX20LISTENER_ROOMROLLOFFFACTOR:
- defer<RoomRolloffFactorValidator>(call, props.flRoomRolloffFactor);
- break;
-
- case DSPROPERTY_EAX20LISTENER_DECAYTIME:
- defer<DecayTimeValidator>(call, props.flDecayTime);
- break;
-
- case DSPROPERTY_EAX20LISTENER_DECAYHFRATIO:
- defer<DecayHFRatioValidator>(call, props.flDecayHFRatio);
- break;
-
- case DSPROPERTY_EAX20LISTENER_REFLECTIONS:
- defer<ReflectionsValidator>(call, props.lReflections);
- break;
-
- case DSPROPERTY_EAX20LISTENER_REFLECTIONSDELAY:
- defer<ReflectionsDelayValidator>(call, props.flReverbDelay);
- break;
-
- case DSPROPERTY_EAX20LISTENER_REVERB:
- defer<ReverbValidator>(call, props.lReverb);
- break;
-
- case DSPROPERTY_EAX20LISTENER_REVERBDELAY:
- defer<ReverbDelayValidator>(call, props.flReverbDelay);
- break;
-
- case DSPROPERTY_EAX20LISTENER_ENVIRONMENT:
- defer<EnvironmentValidator1, EnvironmentDeferrer2>(call, props, props.dwEnvironment);
- break;
-
- case DSPROPERTY_EAX20LISTENER_ENVIRONMENTSIZE:
- defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer2>(call, props, props.flEnvironmentSize);
- break;
-
- case DSPROPERTY_EAX20LISTENER_ENVIRONMENTDIFFUSION:
- defer<EnvironmentDiffusionValidator>(call, props.flEnvironmentDiffusion);
- break;
-
- case DSPROPERTY_EAX20LISTENER_AIRABSORPTIONHF:
- defer<AirAbsorptionHFValidator>(call, props.flAirAbsorptionHF);
- break;
-
- case DSPROPERTY_EAX20LISTENER_FLAGS:
- defer<FlagsValidator2>(call, props.dwFlags);
- break;
-
- default:
- fail_unknown_property_id();
+ case DSPROPERTY_EAX20LISTENER_NONE: break;
+ case DSPROPERTY_EAX20LISTENER_ALLPARAMETERS: defer<AllValidator2>(call, props); break;
+ case DSPROPERTY_EAX20LISTENER_ROOM: defer<RoomValidator>(call, props.lRoom); break;
+ case DSPROPERTY_EAX20LISTENER_ROOMHF: defer<RoomHFValidator>(call, props.lRoomHF); break;
+ case DSPROPERTY_EAX20LISTENER_ROOMROLLOFFFACTOR: defer<RoomRolloffFactorValidator>(call, props.flRoomRolloffFactor); break;
+ case DSPROPERTY_EAX20LISTENER_DECAYTIME: defer<DecayTimeValidator>(call, props.flDecayTime); break;
+ case DSPROPERTY_EAX20LISTENER_DECAYHFRATIO: defer<DecayHFRatioValidator>(call, props.flDecayHFRatio); break;
+ case DSPROPERTY_EAX20LISTENER_REFLECTIONS: defer<ReflectionsValidator>(call, props.lReflections); break;
+ case DSPROPERTY_EAX20LISTENER_REFLECTIONSDELAY: defer<ReflectionsDelayValidator>(call, props.flReverbDelay); break;
+ case DSPROPERTY_EAX20LISTENER_REVERB: defer<ReverbValidator>(call, props.lReverb); break;
+ case DSPROPERTY_EAX20LISTENER_REVERBDELAY: defer<ReverbDelayValidator>(call, props.flReverbDelay); break;
+ case DSPROPERTY_EAX20LISTENER_ENVIRONMENT: defer<EnvironmentValidator1, EnvironmentDeferrer2>(call, props, props.dwEnvironment); break;
+ case DSPROPERTY_EAX20LISTENER_ENVIRONMENTSIZE: defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer2>(call, props, props.flEnvironmentSize); break;
+ case DSPROPERTY_EAX20LISTENER_ENVIRONMENTDIFFUSION: defer<EnvironmentDiffusionValidator>(call, props.flEnvironmentDiffusion); break;
+ case DSPROPERTY_EAX20LISTENER_AIRABSORPTIONHF: defer<AirAbsorptionHFValidator>(call, props.flAirAbsorptionHF); break;
+ case DSPROPERTY_EAX20LISTENER_FLAGS: defer<FlagsValidator2>(call, props.dwFlags); break;
+ default: fail_unknown_property_id();
}
}
@@ -1369,117 +1220,34 @@ void EaxReverbCommitter::Set(const EaxCall &call, EAXREVERBPROPERTIES &props)
{
switch(call.get_property_id())
{
- case EAXREVERB_NONE:
- break;
-
- case EAXREVERB_ALLPARAMETERS:
- defer<AllValidator3>(call, props);
- break;
-
- case EAXREVERB_ENVIRONMENT:
- defer<EnvironmentValidator3, EnvironmentDeferrer3>(call, props, props.ulEnvironment);
- break;
-
- case EAXREVERB_ENVIRONMENTSIZE:
- defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer3>(call, props, props.flEnvironmentSize);
- break;
-
- case EAXREVERB_ENVIRONMENTDIFFUSION:
- defer3<EnvironmentDiffusionValidator>(call, props, props.flEnvironmentDiffusion);
- break;
-
- case EAXREVERB_ROOM:
- defer3<RoomValidator>(call, props, props.lRoom);
- break;
-
- case EAXREVERB_ROOMHF:
- defer3<RoomHFValidator>(call, props, props.lRoomHF);
- break;
-
- case EAXREVERB_ROOMLF:
- defer3<RoomLFValidator>(call, props, props.lRoomLF);
- break;
-
- case EAXREVERB_DECAYTIME:
- defer3<DecayTimeValidator>(call, props, props.flDecayTime);
- break;
-
- case EAXREVERB_DECAYHFRATIO:
- defer3<DecayHFRatioValidator>(call, props, props.flDecayHFRatio);
- break;
-
- case EAXREVERB_DECAYLFRATIO:
- defer3<DecayLFRatioValidator>(call, props, props.flDecayLFRatio);
- break;
-
- case EAXREVERB_REFLECTIONS:
- defer3<ReflectionsValidator>(call, props, props.lReflections);
- break;
-
- case EAXREVERB_REFLECTIONSDELAY:
- defer3<ReflectionsDelayValidator>(call, props, props.flReflectionsDelay);
- break;
-
- case EAXREVERB_REFLECTIONSPAN:
- defer3<VectorValidator>(call, props, props.vReflectionsPan);
- break;
-
- case EAXREVERB_REVERB:
- defer3<ReverbValidator>(call, props, props.lReverb);
- break;
-
- case EAXREVERB_REVERBDELAY:
- defer3<ReverbDelayValidator>(call, props, props.flReverbDelay);
- break;
-
- case EAXREVERB_REVERBPAN:
- defer3<VectorValidator>(call, props, props.vReverbPan);
- break;
-
- case EAXREVERB_ECHOTIME:
- defer3<EchoTimeValidator>(call, props, props.flEchoTime);
- break;
-
- case EAXREVERB_ECHODEPTH:
- defer3<EchoDepthValidator>(call, props, props.flEchoDepth);
- break;
-
- case EAXREVERB_MODULATIONTIME:
- defer3<ModulationTimeValidator>(call, props, props.flModulationTime);
- break;
-
- case EAXREVERB_MODULATIONDEPTH:
- defer3<ModulationDepthValidator>(call, props, props.flModulationDepth);
- break;
-
- case EAXREVERB_AIRABSORPTIONHF:
- defer3<AirAbsorptionHFValidator>(call, props, props.flAirAbsorptionHF);
- break;
-
- case EAXREVERB_HFREFERENCE:
- defer3<HFReferenceValidator>(call, props, props.flHFReference);
- break;
-
- case EAXREVERB_LFREFERENCE:
- defer3<LFReferenceValidator>(call, props, props.flLFReference);
- break;
-
- case EAXREVERB_ROOMROLLOFFFACTOR:
- defer3<RoomRolloffFactorValidator>(call, props, props.flRoomRolloffFactor);
- break;
-
- case EAXREVERB_FLAGS:
- defer3<FlagsValidator3>(call, props, props.ulFlags);
- break;
-
- default:
- fail_unknown_property_id();
+ case EAXREVERB_NONE: break;
+ case EAXREVERB_ALLPARAMETERS: defer<AllValidator3>(call, props); break;
+ case EAXREVERB_ENVIRONMENT: defer<EnvironmentValidator3, EnvironmentDeferrer3>(call, props, props.ulEnvironment); break;
+ case EAXREVERB_ENVIRONMENTSIZE: defer<EnvironmentSizeValidator, EnvironmentSizeDeferrer3>(call, props, props.flEnvironmentSize); break;
+ case EAXREVERB_ENVIRONMENTDIFFUSION: defer3<EnvironmentDiffusionValidator>(call, props, props.flEnvironmentDiffusion); break;
+ case EAXREVERB_ROOM: defer3<RoomValidator>(call, props, props.lRoom); break;
+ case EAXREVERB_ROOMHF: defer3<RoomHFValidator>(call, props, props.lRoomHF); break;
+ case EAXREVERB_ROOMLF: defer3<RoomLFValidator>(call, props, props.lRoomLF); break;
+ case EAXREVERB_DECAYTIME: defer3<DecayTimeValidator>(call, props, props.flDecayTime); break;
+ case EAXREVERB_DECAYHFRATIO: defer3<DecayHFRatioValidator>(call, props, props.flDecayHFRatio); break;
+ case EAXREVERB_DECAYLFRATIO: defer3<DecayLFRatioValidator>(call, props, props.flDecayLFRatio); break;
+ case EAXREVERB_REFLECTIONS: defer3<ReflectionsValidator>(call, props, props.lReflections); break;
+ case EAXREVERB_REFLECTIONSDELAY: defer3<ReflectionsDelayValidator>(call, props, props.flReflectionsDelay); break;
+ case EAXREVERB_REFLECTIONSPAN: defer3<VectorValidator>(call, props, props.vReflectionsPan); break;
+ case EAXREVERB_REVERB: defer3<ReverbValidator>(call, props, props.lReverb); break;
+ case EAXREVERB_REVERBDELAY: defer3<ReverbDelayValidator>(call, props, props.flReverbDelay); break;
+ case EAXREVERB_REVERBPAN: defer3<VectorValidator>(call, props, props.vReverbPan); break;
+ case EAXREVERB_ECHOTIME: defer3<EchoTimeValidator>(call, props, props.flEchoTime); break;
+ case EAXREVERB_ECHODEPTH: defer3<EchoDepthValidator>(call, props, props.flEchoDepth); break;
+ case EAXREVERB_MODULATIONTIME: defer3<ModulationTimeValidator>(call, props, props.flModulationTime); break;
+ case EAXREVERB_MODULATIONDEPTH: defer3<ModulationDepthValidator>(call, props, props.flModulationDepth); break;
+ case EAXREVERB_AIRABSORPTIONHF: defer3<AirAbsorptionHFValidator>(call, props, props.flAirAbsorptionHF); break;
+ case EAXREVERB_HFREFERENCE: defer3<HFReferenceValidator>(call, props, props.flHFReference); break;
+ case EAXREVERB_LFREFERENCE: defer3<LFReferenceValidator>(call, props, props.flLFReference); break;
+ case EAXREVERB_ROOMROLLOFFFACTOR: defer3<RoomRolloffFactorValidator>(call, props, props.flRoomRolloffFactor); break;
+ case EAXREVERB_FLAGS: defer3<FlagsValidator3>(call, props, props.ulFlags); break;
+ default: fail_unknown_property_id();
}
}
-void EaxReverbCommitter::Set(const EaxCall &call, EaxEffectProps &props)
-{
- Set(call, std::get<EAXREVERBPROPERTIES>(props));
-}
-
#endif // ALSOFT_EAX