diff options
author | Chris Robinson <[email protected]> | 2010-09-24 13:16:09 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-09-24 13:16:09 -0700 |
commit | 117ed52091a2a24d912c51a8a1c3a97cc5f4d4d5 (patch) | |
tree | f91ae98a2f542d6d322747f3e62d13de877b74eb /Alc/ALu.c | |
parent | e9d5e53dbe46c3dda6f663bbfbc276b99545df17 (diff) |
Better protect against negative attenuation
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r-- | Alc/ALu.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |