aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-03-18 08:20:08 -0700
committerChris Robinson <[email protected]>2012-03-18 08:20:08 -0700
commit5d08563975ff07696f4e0ac184d7a0f74f70dbc6 (patch)
treedc0c1930c9355760fbe3e16ca5e29ce05ee68b76
parentadb83ad3c0ee2b952db693af3a7ba9b82776e03f (diff)
Handle very small speed of sound values
-rw-r--r--Alc/ALu.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index fc0980e8..4a0d4d38 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -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;