Flip the parameters to aluCart2LUTpos, so it behaves a bit more like atan2
This commit is contained in:
parent
26456f13e1
commit
267d38cf20
@ -206,8 +206,8 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
||||
DryGain *= aluSqrt(2.0f/4.0f);
|
||||
for(c = 0;c < 2;c++)
|
||||
{
|
||||
pos = aluCart2LUTpos(aluCos(RearMap[c].angle),
|
||||
aluSin(RearMap[c].angle));
|
||||
pos = aluCart2LUTpos(aluSin(RearMap[c].angle),
|
||||
aluCos(RearMap[c].angle));
|
||||
ChannelGain = Device->PanningLUT[pos];
|
||||
|
||||
for(i = 0;i < (ALint)Device->NumChan;i++)
|
||||
@ -299,7 +299,7 @@ ALvoid CalcNonAttnSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
||||
SrcMatrix[c][LFE] += DryGain;
|
||||
continue;
|
||||
}
|
||||
pos = aluCart2LUTpos(aluCos(chans[c].angle), aluSin(chans[c].angle));
|
||||
pos = aluCart2LUTpos(aluSin(chans[c].angle), aluCos(chans[c].angle));
|
||||
ChannelGain = Device->PanningLUT[pos];
|
||||
|
||||
for(i = 0;i < (ALint)Device->NumChan;i++)
|
||||
@ -761,7 +761,7 @@ ALvoid CalcSourceParams(ALsource *ALSource, const ALCcontext *ALContext)
|
||||
Position[2] *= invlen;
|
||||
}
|
||||
|
||||
pos = aluCart2LUTpos(-Position[2]*ZScale, Position[0]);
|
||||
pos = aluCart2LUTpos(Position[0], -Position[2]*ZScale);
|
||||
ChannelGain = Device->PanningLUT[pos];
|
||||
|
||||
/* Adjustment for partial panning. Not the greatest, but simple
|
||||
|
@ -64,7 +64,7 @@ static ALvoid DedicatedUpdate(ALeffectState *effect, ALCdevice *device, const AL
|
||||
|
||||
if(Slot->effect.type == AL_EFFECT_DEDICATED_DIALOGUE)
|
||||
{
|
||||
pos = aluCart2LUTpos(1.0f, 0.0f);
|
||||
pos = aluCart2LUTpos(0.0f, 1.0f);
|
||||
ChannelGain = device->PanningLUT[pos];
|
||||
|
||||
for(s = 0;s < MAXCHANNELS;s++)
|
||||
|
@ -122,7 +122,7 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffec
|
||||
dirGain = aluFabs(lrpan);
|
||||
|
||||
/* First tap panning */
|
||||
pos = aluCart2LUTpos(0.0f, ((lrpan>0.0f)?-1.0f:1.0f));
|
||||
pos = aluCart2LUTpos(((lrpan>0.0f)?-1.0f:1.0f), 0.0f);
|
||||
ChannelGain = Device->PanningLUT[pos];
|
||||
|
||||
for(i = 0;i < Device->NumChan;i++)
|
||||
@ -132,7 +132,7 @@ static ALvoid EchoUpdate(ALeffectState *effect, ALCdevice *Device, const ALeffec
|
||||
}
|
||||
|
||||
/* Second tap panning */
|
||||
pos = aluCart2LUTpos(0.0f, ((lrpan>0.0f)?1.0f:-1.0f));
|
||||
pos = aluCart2LUTpos(((lrpan>0.0f)?1.0f:-1.0f), 0.0f);
|
||||
ChannelGain = Device->PanningLUT[pos];
|
||||
|
||||
for(i = 0;i < Device->NumChan;i++)
|
||||
|
@ -1053,7 +1053,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection
|
||||
* approximation of the expansion of sound across the speakers from the
|
||||
* panning direction.
|
||||
*/
|
||||
pos = aluCart2LUTpos(earlyPan[2], earlyPan[0]);
|
||||
pos = aluCart2LUTpos(earlyPan[0], earlyPan[2]);
|
||||
ChannelGain = Device->PanningLUT[pos];
|
||||
dirGain = aluSqrt((earlyPan[0] * earlyPan[0]) + (earlyPan[2] * earlyPan[2]));
|
||||
|
||||
@ -1066,7 +1066,7 @@ static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *Reflection
|
||||
}
|
||||
|
||||
|
||||
pos = aluCart2LUTpos(latePan[2], latePan[0]);
|
||||
pos = aluCart2LUTpos(latePan[0], latePan[2]);
|
||||
ChannelGain = Device->PanningLUT[pos];
|
||||
dirGain = aluSqrt((latePan[0] * latePan[0]) + (latePan[2] * latePan[2]));
|
||||
|
||||
|
@ -150,10 +150,10 @@ static ALfloat aluLUTpos2Angle(ALint pos)
|
||||
return aluAtan((ALfloat)(pos - 3 * QUADRANT_NUM) / (ALfloat)(4 * QUADRANT_NUM - pos)) - F_PI_2;
|
||||
}
|
||||
|
||||
ALint aluCart2LUTpos(ALfloat re, ALfloat im)
|
||||
ALint aluCart2LUTpos(ALfloat im, ALfloat re)
|
||||
{
|
||||
ALint pos = 0;
|
||||
ALfloat denom = aluFabs(re) + aluFabs(im);
|
||||
ALfloat denom = aluFabs(im) + aluFabs(re);
|
||||
if(denom > 0.0f)
|
||||
pos = (ALint)(QUADRANT_NUM*aluFabs(im) / denom + 0.5);
|
||||
|
||||
|
@ -296,7 +296,7 @@ static __inline void aluNormalize(ALfloat *inVector)
|
||||
|
||||
|
||||
ALvoid aluInitPanning(ALCdevice *Device);
|
||||
ALint aluCart2LUTpos(ALfloat re, ALfloat im);
|
||||
ALint aluCart2LUTpos(ALfloat im, ALfloat re);
|
||||
|
||||
ALvoid CalcSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext);
|
||||
ALvoid CalcNonAttnSourceParams(struct ALsource *ALSource, const ALCcontext *ALContext);
|
||||
|
Loading…
x
Reference in New Issue
Block a user