aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.c
diff options
context:
space:
mode:
Diffstat (limited to 'Alc/panning.c')
-rw-r--r--Alc/panning.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index 5c0f68fd..43c55cad 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -146,6 +146,20 @@ static ALfloat aluLUTpos2Angle(ALint pos)
return aluAtan((ALfloat)(pos - 3 * QUADRANT_NUM) / (ALfloat)(4 * QUADRANT_NUM - pos)) - M_PI_2;
}
+ALint aluCart2LUTpos(ALfloat re, ALfloat im)
+{
+ ALint pos = 0;
+ ALfloat denom = aluFabs(re) + aluFabs(im);
+ if(denom > 0.0f)
+ pos = (ALint)(QUADRANT_NUM*aluFabs(im) / denom + 0.5);
+
+ if(re < 0.0)
+ pos = 2 * QUADRANT_NUM - pos;
+ if(im < 0.0)
+ pos = LUT_NUM - pos;
+ return pos%LUT_NUM;
+}
+
ALvoid aluInitPanning(ALCdevice *Device)
{
ALfloat SpeakerAngle[OUTPUTCHANNELS];