summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-09-24 13:16:09 -0700
committerChris Robinson <[email protected]>2010-09-24 13:16:09 -0700
commit117ed52091a2a24d912c51a8a1c3a97cc5f4d4d5 (patch)
treef91ae98a2f542d6d322747f3e62d13de877b74eb
parente9d5e53dbe46c3dda6f663bbfbc276b99545df17 (diff)
Better protect against negative attenuation
-rw-r--r--Alc/ALu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index d54b9f09..1299e98c 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -396,12 +396,15 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
break;
//fall-through
case AL_LINEAR_DISTANCE:
- Distance=__min(Distance,MaxDist);
if(MaxDist != MinDist)
{
flAttenuation = 1.0f - (Rolloff*(Distance-MinDist)/(MaxDist - MinDist));
+ flAttenuation = __max(flAttenuation, 0.0f);
for(i = 0;i < NumSends;i++)
+ {
RoomAttenuation[i] = 1.0f - (RoomRolloff[i]*(Distance-MinDist)/(MaxDist - MinDist));
+ RoomAttenuation[i] = __max(RoomAttenuation[i], 0.0f);
+ }
}
break;