summaryrefslogtreecommitdiffstats
path: root/Alc/panning.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-10-10 09:39:02 -0700
committerChris Robinson <[email protected]>2011-10-10 09:39:02 -0700
commit3bbde05e0e220427b0eae5d6b13a994995ae4646 (patch)
tree03461e781b8beb1c6ecdd450598bb141367280f5 /Alc/panning.c
parent3324bab81efb774d5ffa9374c17fb2588b1cc9ae (diff)
Use the square root to build the panning table instead of sin/cos
Diffstat (limited to 'Alc/panning.c')
-rw-r--r--Alc/panning.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index b125fed8..0d83ea30 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -293,10 +293,10 @@ ALvoid aluInitPanning(ALCdevice *Device)
if(Theta >= SpeakerAngle[s] && Theta < SpeakerAngle[s+1])
{
/* source between speaker s and speaker s+1 */
- Alpha = F_PI_2 * (Theta-SpeakerAngle[s]) /
- (SpeakerAngle[s+1]-SpeakerAngle[s]);
- PanningLUT[Speaker2Chan[s]] = aluCos(Alpha);
- PanningLUT[Speaker2Chan[s+1]] = aluSin(Alpha);
+ Alpha = (Theta-SpeakerAngle[s]) /
+ (SpeakerAngle[s+1]-SpeakerAngle[s]);
+ PanningLUT[Speaker2Chan[s]] = aluSqrt(1.0f-Alpha);
+ PanningLUT[Speaker2Chan[s+1]] = aluSqrt( Alpha);
break;
}
}
@@ -305,10 +305,10 @@ ALvoid aluInitPanning(ALCdevice *Device)
/* source between last and first speaker */
if(Theta < SpeakerAngle[0])
Theta += F_PI*2.0f;
- Alpha = F_PI_2 * (Theta-SpeakerAngle[s]) /
- (F_PI*2.0f + SpeakerAngle[0]-SpeakerAngle[s]);
- PanningLUT[Speaker2Chan[s]] = aluCos(Alpha);
- PanningLUT[Speaker2Chan[0]] = aluSin(Alpha);
+ Alpha = (Theta-SpeakerAngle[s]) /
+ (F_PI*2.0f + SpeakerAngle[0]-SpeakerAngle[s]);
+ PanningLUT[Speaker2Chan[s]] = aluSqrt(1.0f-Alpha);
+ PanningLUT[Speaker2Chan[0]] = aluSqrt( Alpha);
}
}
}