aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-10-20 11:03:16 -0700
committerChris Robinson <[email protected]>2009-10-20 11:03:16 -0700
commit50f963f6c67f9c4f2ec6caaad8edc1679e70b8b9 (patch)
tree0bac5ab29160b89a8395214590c396118e7eee1a /Alc
parent67c3e47ed4c1a0e54e8bf8f1d0c05d38a5fa7e19 (diff)
Don't try to clamp the listener-to-source velocity for local sources
Local sources will always have a 0 VLS value
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALu.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 755c8bf0..49ac2ad8 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -424,7 +424,7 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext,
ALfloat MinVolume,MaxVolume,MinDist,MaxDist,Rolloff,OuterGainHF;
ALfloat ConeVolume,ConeHF,SourceVolume,ListenerGain;
ALfloat U[3],V[3],N[3];
- ALfloat DopplerFactor, DopplerVelocity, flSpeedOfSound, flMaxVelocity;
+ ALfloat DopplerFactor, DopplerVelocity, flSpeedOfSound;
ALfloat Matrix[3][3];
ALfloat flAttenuation;
ALfloat RoomAttenuation[MAX_SENDS];
@@ -666,22 +666,23 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext,
if(DopplerFactor != 0.0f)
{
ALfloat flVSS, flVLS = 0.0f;
+ ALfloat flMaxVelocity = (DopplerVelocity * flSpeedOfSound) /
+ DopplerFactor;
- if(ALSource->bHeadRelative==AL_FALSE)
- flVLS = aluDotproduct(ALContext->Listener.Velocity, SourceToListener);
flVSS = aluDotproduct(ALSource->vVelocity, SourceToListener);
-
- flMaxVelocity = (DopplerVelocity * flSpeedOfSound) / DopplerFactor;
-
if(flVSS >= flMaxVelocity)
flVSS = (flMaxVelocity - 1.0f);
else if(flVSS <= -flMaxVelocity)
flVSS = -flMaxVelocity + 1.0f;
- if(flVLS >= flMaxVelocity)
- flVLS = (flMaxVelocity - 1.0f);
- else if(flVLS <= -flMaxVelocity)
- flVLS = -flMaxVelocity + 1.0f;
+ if(ALSource->bHeadRelative == AL_FALSE)
+ {
+ flVLS = aluDotproduct(ALContext->Listener.Velocity, SourceToListener);
+ if(flVLS >= flMaxVelocity)
+ flVLS = (flMaxVelocity - 1.0f);
+ else if(flVLS <= -flMaxVelocity)
+ flVLS = -flMaxVelocity + 1.0f;
+ }
pitch[0] = ALSource->flPitch *
((flSpeedOfSound * DopplerVelocity) - (DopplerFactor * flVLS)) /