diff options
author | Chris Robinson <[email protected]> | 2011-05-21 17:45:54 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-05-21 17:45:54 -0700 |
commit | a9d9553fff7f3ec571770a9b4a22c5a46f91780f (patch) | |
tree | 7b6e545b9dd1f5544975936cef8daf014af7656d /Alc | |
parent | 5cdf774ea7d8ad8e9a6316401e39647040761a3a (diff) |
Use a multi-dimensional array for the panning LUT
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALu.c | 6 | ||||
-rw-r--r-- | Alc/alcDedicated.c | 2 | ||||
-rw-r--r-- | Alc/alcReverb.c | 4 | ||||
-rw-r--r-- | Alc/panning.c | 19 |
4 files changed, 15 insertions, 16 deletions
@@ -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); } } } |