aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-03-09 22:38:26 -0800
committerChris Robinson <[email protected]>2012-03-09 22:38:26 -0800
commit7db29a233249fd0c0ce37064c118072ca5b5a29e (patch)
treee23238e1c3d46c32e8b84baa65ae82b21b18069f
parent6e70ae9958fe8e0f2abfa8d0acc198f0ef053af6 (diff)
Clamp the upper and lower bound of the doppler velocity scale more like the original
-rw-r--r--Alc/ALu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 29950d77..223928bb 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -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;