aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-05-21 17:45:54 -0700
committerChris Robinson <[email protected]>2011-05-21 17:45:54 -0700
commita9d9553fff7f3ec571770a9b4a22c5a46f91780f (patch)
tree7b6e545b9dd1f5544975936cef8daf014af7656d
parent5cdf774ea7d8ad8e9a6316401e39647040761a3a (diff)
Use a multi-dimensional array for the panning LUT
-rw-r--r--Alc/ALu.c6
-rw-r--r--Alc/alcDedicated.c2
-rw-r--r--Alc/alcReverb.c4
-rw-r--r--Alc/panning.c19
-rw-r--r--OpenAL32/Include/alMain.h2
5 files changed, 16 insertions, 17 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index cd0c2177..b387d7e1 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -188,7 +188,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
{
pos = aluCart2LUTpos(cos(angles_StereoDup[c] * (M_PI/180.0)),
sin(angles_StereoDup[c] * (M_PI/180.0)));
- SpeakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
+ SpeakerGain = Device->PanningLUT[pos];
for(i = 0;i < (ALint)Device->NumChan;i++)
{
@@ -266,7 +266,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
pos = aluCart2LUTpos(cos(angles[c] * (M_PI/180.0)),
sin(angles[c] * (M_PI/180.0)));
- SpeakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
+ SpeakerGain = Device->PanningLUT[pos];
for(i = 0;i < (ALint)Device->NumChan;i++)
{
@@ -692,7 +692,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
}
pos = aluCart2LUTpos(-Position[2]*ZScale, Position[0]);
- SpeakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
+ SpeakerGain = Device->PanningLUT[pos];
DirGain = aluSqrt(Position[0]*Position[0] + Position[2]*Position[2]);
// elevation adjustment for directional gain. this sucks, but
diff --git a/Alc/alcDedicated.c b/Alc/alcDedicated.c
index 0b9d8419..6bab83e5 100644
--- a/Alc/alcDedicated.c
+++ b/Alc/alcDedicated.c
@@ -59,7 +59,7 @@ static ALvoid DedicatedDLGUpdate(ALeffectState *effect, ALCcontext *Context, con
ALsizei s;
pos = aluCart2LUTpos(1.0f, 0.0f);
- SpeakerGain = &device->PanningLUT[MAXCHANNELS * pos];
+ SpeakerGain = device->PanningLUT[pos];
for(s = 0;s < MAXCHANNELS;s++)
state->gains[s] = SpeakerGain[s] * Effect->Params.Dedicated.Gain;
diff --git a/Alc/alcReverb.c b/Alc/alcReverb.c
index 4ecf615e..20638710 100644
--- a/Alc/alcReverb.c
+++ b/Alc/alcReverb.c
@@ -627,7 +627,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection
* panning direction.
*/
pos = aluCart2LUTpos(earlyPan[2], earlyPan[0]);
- speakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
+ speakerGain = Device->PanningLUT[pos];
dirGain = aluSqrt((earlyPan[0] * earlyPan[0]) + (earlyPan[2] * earlyPan[2]));
for(index = 0;index < MAXCHANNELS;index++)
@@ -640,7 +640,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection
pos = aluCart2LUTpos(latePan[2], latePan[0]);
- speakerGain = &Device->PanningLUT[MAXCHANNELS * pos];
+ speakerGain = Device->PanningLUT[pos];
dirGain = aluSqrt((latePan[0] * latePan[0]) + (latePan[2] * latePan[2]));
for(index = 0;index < MAXCHANNELS;index++)
diff --git a/Alc/panning.c b/Alc/panning.c
index b5352e2b..a5a92298 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -168,8 +168,7 @@ ALvoid aluInitPanning(ALCdevice *Device)
ALfloat SpeakerAngle[MAXCHANNELS];
Channel *Speaker2Chan;
ALfloat Alpha, Theta;
- ALfloat *PanningLUT;
- ALint pos, offset;
+ ALint pos;
ALuint s;
Speaker2Chan = Device->Speaker2Chan;
@@ -255,17 +254,17 @@ ALvoid aluInitPanning(ALCdevice *Device)
break;
}
- PanningLUT = Device->PanningLUT;
for(pos = 0; pos < LUT_NUM; pos++)
{
+ ALfloat *PanningLUT = Device->PanningLUT[pos];
+
/* clear all values */
- offset = MAXCHANNELS * pos;
for(s = 0; s < MAXCHANNELS; s++)
- PanningLUT[offset+s] = 0.0f;
+ PanningLUT[s] = 0.0f;
if(Device->NumChan == 1)
{
- PanningLUT[offset + Speaker2Chan[0]] = 1.0f;
+ PanningLUT[Speaker2Chan[0]] = 1.0f;
continue;
}
@@ -280,8 +279,8 @@ ALvoid aluInitPanning(ALCdevice *Device)
/* source between speaker s and speaker s+1 */
Alpha = M_PI_2 * (Theta-SpeakerAngle[s]) /
(SpeakerAngle[s+1]-SpeakerAngle[s]);
- PanningLUT[offset + Speaker2Chan[s]] = cos(Alpha);
- PanningLUT[offset + Speaker2Chan[s+1]] = sin(Alpha);
+ PanningLUT[Speaker2Chan[s]] = cos(Alpha);
+ PanningLUT[Speaker2Chan[s+1]] = sin(Alpha);
break;
}
}
@@ -292,8 +291,8 @@ ALvoid aluInitPanning(ALCdevice *Device)
Theta += 2.0f * M_PI;
Alpha = M_PI_2 * (Theta-SpeakerAngle[s]) /
(2.0f * M_PI + SpeakerAngle[0]-SpeakerAngle[s]);
- PanningLUT[offset + Speaker2Chan[s]] = cos(Alpha);
- PanningLUT[offset + Speaker2Chan[0]] = sin(Alpha);
+ PanningLUT[Speaker2Chan[s]] = cos(Alpha);
+ PanningLUT[Speaker2Chan[0]] = sin(Alpha);
}
}
}
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 67481e67..82d17b63 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -489,7 +489,7 @@ struct ALCdevice_struct
ALuint DevChannels[MAXCHANNELS];
Channel Speaker2Chan[MAXCHANNELS];
- ALfloat PanningLUT[MAXCHANNELS * LUT_NUM];
+ ALfloat PanningLUT[LUT_NUM][MAXCHANNELS];
ALuint NumChan;
ALfloat ClickRemoval[MAXCHANNELS];