Clamp the upper and lower bound of the doppler velocity scale more like the original

This commit is contained in:
Chris Robinson
2012-03-09 22:38:26 -08:00
parent 6e70ae9958
commit 7db29a2332
+3 -2
View File
@@ -625,14 +625,15 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
// Calculate Velocity
if(DopplerFactor > 0.0f)
if(DopplerFactor > 0.0f && SpeedOfSound > 0.5f)
{
ALfloat VSS, VLS;
VSS = aluDotproduct(Velocity, SourceToListener) * DopplerFactor;
VLS = aluDotproduct(ListenerVel, SourceToListener) * DopplerFactor;
Pitch *= maxf(SpeedOfSound-VLS, 1.0f) / maxf(SpeedOfSound-VSS, 1.0f);
Pitch *= clampf(SpeedOfSound-VLS, 1.0f, SpeedOfSound*2.0f - 1.0f) /
clampf(SpeedOfSound-VSS, 1.0f, SpeedOfSound*2.0f - 1.0f);
}
BufferListItem = ALSource->queue;