Handle very small speed of sound values

This commit is contained in:
Chris Robinson 2012-03-18 08:20:08 -07:00
parent adb83ad3c0
commit 5d08563975

View File

@ -636,10 +636,16 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
// Calculate Velocity
if(DopplerFactor > 0.0f && SpeedOfSound > 0.5f)
if(DopplerFactor > 0.0f)
{
ALfloat VSS, VLS;
if(SpeedOfSound < 1.0f)
{
DopplerFactor *= 1.0f/SpeedOfSound;
SpeedOfSound = 1.0f;
}
VSS = aluDotproduct(Velocity, SourceToListener) * DopplerFactor;
VLS = aluDotproduct(ListenerVel, SourceToListener) * DopplerFactor;