diff options
author | Chris Robinson <[email protected]> | 2017-09-22 05:42:04 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-09-22 05:42:04 -0700 |
commit | 369f52a0d76e1be1407441ca0bb67343cffa95f3 (patch) | |
tree | ab40abba1c463603f9401a7dc08cf207379b9794 /Alc/ALu.c | |
parent | 9007b7735519b049668ccd0c787ef52a00934386 (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.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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) { |