aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-09-22 05:42:04 -0700
committerChris Robinson <[email protected]>2017-09-22 05:42:04 -0700
commit369f52a0d76e1be1407441ca0bb67343cffa95f3 (patch)
treeab40abba1c463603f9401a7dc08cf207379b9794 /Alc/ALu.c
parent9007b7735519b049668ccd0c787ef52a00934386 (diff)
Add an option to ignore the app's speed of sound for reverb decay
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 dcd00c5b..a2ea4811 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -89,6 +89,9 @@ ALfloat ConeScale = 1.0f;
/* Localized Z scalar for mono sources */
ALfloat ZScale = 1.0f;
+/* Force default speed of sound for distance-related reverb decay. */
+ALboolean OverrideReverbSpeedOfSound = AL_FALSE;
+
const aluMatrixf IdentityMatrixf = {{
{ 1.0f, 0.0f, 0.0f, 0.0f },
{ 0.0f, 1.0f, 0.0f, 0.0f },
@@ -312,6 +315,11 @@ static ALboolean CalcListenerParams(ALCcontext *Context)
Listener->Params.DopplerFactor = props->DopplerFactor;
Listener->Params.SpeedOfSound = props->SpeedOfSound * props->DopplerVelocity;
+ if(OverrideReverbSpeedOfSound)
+ Listener->Params.ReverbSpeedOfSound = SPEEDOFSOUNDMETRESPERSEC;
+ else
+ Listener->Params.ReverbSpeedOfSound = Listener->Params.SpeedOfSound *
+ Listener->Params.MetersPerUnit;
Listener->Params.SourceDistanceModel = props->SourceDistanceModel;
Listener->Params.DistanceModel = props->DistanceModel;
@@ -1105,8 +1113,8 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *prop
else if(SendSlots[i]->Params.AuxSendAuto)
{
RoomRolloff[i] = SendSlots[i]->Params.RoomRolloff + props->RoomRolloffFactor;
- DecayDistance[i] = SendSlots[i]->Params.DecayTime * Listener->Params.SpeedOfSound *
- Listener->Params.MetersPerUnit;
+ DecayDistance[i] = SendSlots[i]->Params.DecayTime *
+ Listener->Params.ReverbSpeedOfSound;
DecayHFDistance[i] = DecayDistance[i] * SendSlots[i]->Params.DecayHFRatio;
if(SendSlots[i]->Params.DecayHFLimit)
{