diff options
author | Chris Robinson <[email protected]> | 2009-12-08 10:12:18 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2009-12-08 10:12:18 -0800 |
commit | 1694e5bd12d021169cf6cf541c5a5d0c652c8989 (patch) | |
tree | 11d3e72eab26cbdf2997385c37ca01ca8d4b6a31 /Alc | |
parent | 5170e251f941496f2e07b5fefef9dcf481e0ad4f (diff) |
Store the original pre-clamped distance instead of re-computing it
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -408,7 +408,7 @@ ALvoid aluInitPanning(ALCcontext *Context) static ALvoid CalcSourceParams(const ALCcontext *ALContext, ALsource *ALSource, ALboolean isMono) { - ALfloat InnerAngle,OuterAngle,Angle,Distance,DryMix; + ALfloat InnerAngle,OuterAngle,Angle,Distance,DryMix,OrigDist; ALfloat Direction[3],Position[3],SourceToListener[3]; ALfloat Velocity[3],ListenerVel[3]; ALfloat MinVolume,MaxVolume,MinDist,MaxDist,Rolloff,OuterGainHF; @@ -584,6 +584,7 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, ALsource *ALSource, //2. Calculate distance attenuation Distance = aluSqrt(aluDotproduct(Position, Position)); + OrigDist = Distance; flAttenuation = 1.0f; for(i = 0;i < NumSends;i++) @@ -808,9 +809,7 @@ static ALvoid CalcSourceParams(const ALCcontext *ALContext, ALsource *ALSource, ALSource->Params.Pitch = ALSource->flPitch; // Use energy-preserving panning algorithm for multi-speaker playback - length = aluSqrt(Position[0]*Position[0] + Position[1]*Position[1] + - Position[2]*Position[2]); - length = __max(length, MinDist); + length = __max(OrigDist, MinDist); if(length > 0.0f) { ALfloat invlen = 1.0f/length; |