aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-11-19 11:06:41 -0800
committerChris Robinson <[email protected]>2009-11-19 11:06:41 -0800
commitfe37f1968dcf3fa899fbbc05bfd1ef911161a339 (patch)
tree9a0e19999f4e85285f7df058b89b5b9d776ea887 /Alc
parent4565bdd7ceb21e424ea3266e8c191725f5c575db (diff)
Better approximate the wet attenuation model for reverb
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 21373fb2..20661d58 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -704,9 +704,24 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, ALsource *ALSource,
if(ALSource->WetGainHFAuto)
WetGainHF[i] *= ConeHF;
- // Apply minimal attenuation in place of missing
- // statistical reverb model.
- WetGain[i] *= pow(DryMix, 1.0f / 2.0f);
+ if(ALSource->Send[i].Slot->effect.type == AL_EFFECT_REVERB ||
+ ALSource->Send[i].Slot->effect.type == AL_EFFECT_EAXREVERB)
+ {
+ /* Apply a decay-time transformation to the wet path,
+ * based on the attenuation of the dry path. This should
+ * better approximate the statistical attenuation model
+ * for the reverb effect.
+ *
+ * This simple equation converts the distance attenuation
+ * into the time it would take to reach -60 dB. From
+ * there it establishes an origin (0.333s; the decay time
+ * that will produce equal attenuation) and applies the
+ * current decay time. Finally, it converts the result
+ * back to an attenuation for the reverb path.
+ */
+ WetGain[i] *= pow(10.0f, log10(flAttenuation) * 0.333f /
+ ALSource->Send[i].Slot->effect.Reverb.DecayTime);
+ }
}
else
{