diff options
author | Chris Robinson <[email protected]> | 2009-10-20 11:03:16 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-10-20 11:03:16 -0700 |
commit | 50f963f6c67f9c4f2ec6caaad8edc1679e70b8b9 (patch) | |
tree | 0bac5ab29160b89a8395214590c396118e7eee1a /Alc | |
parent | 67c3e47ed4c1a0e54e8bf8f1d0c05d38a5fa7e19 (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.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -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)) / |