From 3bbde05e0e220427b0eae5d6b13a994995ae4646 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 10 Oct 2011 09:39:02 -0700 Subject: Use the square root to build the panning table instead of sin/cos --- Alc/panning.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Alc') 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); } } } -- cgit v1.2.3