aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-11 22:18:11 -0700
committerChris Robinson <[email protected]>2018-03-11 22:18:11 -0700
commit6b35a4534f1047c8e6ec630cbae89ea3e25e5d74 (patch)
treee54b8697e6b3d5ee20e8b0f1375d2063a65162c1 /Alc/ALu.c
parentdac93794491a9219ebdc6815244db76244f45b09 (diff)
Comment and clarify some code
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 7461dcbf..12708cc5 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1215,6 +1215,9 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop
else if(SendSlots[i]->Params.AuxSendAuto)
{
RoomRolloff[i] = SendSlots[i]->Params.RoomRolloff + props->RoomRolloffFactor;
+ /* Calculate the distances to where this effect's decay reaches
+ * -60dB.
+ */
DecayDistance[i] = SendSlots[i]->Params.DecayTime *
Listener->Params.ReverbSpeedOfSound;
DecayHFDistance[i] = DecayDistance[i] * SendSlots[i]->Params.DecayHFRatio;
@@ -1223,8 +1226,13 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop
ALfloat airAbsorption = SendSlots[i]->Params.AirAbsorptionGainHF;
if(airAbsorption < 1.0f)
{
- ALfloat limitRatio = log10f(REVERB_DECAY_GAIN) / log10f(airAbsorption);
- DecayHFDistance[i] = minf(limitRatio, DecayHFDistance[i]);
+ /* Calculate the distance to where this effect's air
+ * absorption reaches -60dB, and limit the effect's HF
+ * decay distance (so it doesn't take any longer to decay
+ * than the air would allow).
+ */
+ ALfloat absorb_dist = log10f(REVERB_DECAY_GAIN) / log10f(airAbsorption);
+ DecayHFDistance[i] = minf(absorb_dist, DecayHFDistance[i]);
}
}
}