aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-08-02 09:16:12 -0700
committerChris Robinson <[email protected]>2016-08-02 09:16:12 -0700
commitf1e3f0762ba7ffdfb45693b92c0ebde2f18414d4 (patch)
tree5bbcc58a7730afb15ca4424c2097f8d94bd8340b /Alc/panning.c
parent0fcd39c4c0205b8229df16f48b05cf0bf6600287 (diff)
Use the ACN and N3D map and scale lookup tables in SetChannelMap
Diffstat (limited to 'Alc/panning.c')
-rw-r--r--Alc/panning.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index d4d7c25b..2d7502ec 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -345,6 +345,8 @@ static void SetChannelMap(const enum Channel *devchans, ChannelConfig *ambicoeff
const ChannelMap *chanmap, size_t count, ALuint *outcount,
ALboolean isfuma)
{
+ const ALuint *acnmap = isfuma ? FuMa2ACN : ACN2ACN;
+ const ALfloat *n3dscale = isfuma ? FuMa2N3DScale : UnitScale;
size_t j, k;
ALuint i;
@@ -362,19 +364,10 @@ static void SetChannelMap(const enum Channel *devchans, ChannelConfig *ambicoeff
if(devchans[i] != chanmap[j].ChanName)
continue;
- if(isfuma)
+ for(k = 0;k < MAX_AMBI_COEFFS;++k)
{
- /* Reformat FuMa -> ACN/N3D */
- for(k = 0;k < MAX_AMBI_COEFFS;++k)
- {
- ALuint acn = FuMa2ACN[k];
- ambicoeffs[i][acn] = chanmap[j].Config[k] / FuMa2N3DScale[acn];
- }
- }
- else
- {
- for(k = 0;k < MAX_AMBI_COEFFS;++k)
- ambicoeffs[i][k] = chanmap[j].Config[k];
+ ALuint acn = acnmap[k];
+ ambicoeffs[i][acn] = chanmap[j].Config[k] / n3dscale[acn];
}
break;
}
@@ -587,9 +580,9 @@ static void InitPanning(ALCdevice *device)
if(device->FmtChans >= DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3)
{
const ALuint *acnmap = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2ACN : ACN2ACN;
- const ALfloat *n3dcale = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2N3DScale :
- (device->AmbiFmt == AmbiFormat_ACN_SN3D) ? SN3D2N3DScale :
- /*(device->AmbiFmt == AmbiFormat_ACN_N3D) ?*/ UnitScale;
+ const ALfloat *n3dscale = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2N3DScale :
+ (device->AmbiFmt == AmbiFormat_ACN_SN3D) ? SN3D2N3DScale :
+ /*(device->AmbiFmt == AmbiFormat_ACN_N3D) ?*/ UnitScale;
count = (device->FmtChans == DevFmtAmbi3) ? 16 :
(device->FmtChans == DevFmtAmbi2) ? 9 :
@@ -597,7 +590,7 @@ static void InitPanning(ALCdevice *device)
for(i = 0;i < count;i++)
{
ALuint acn = acnmap[i];
- device->Dry.Ambi.Map[i].Scale = 1.0f/n3dcale[acn];
+ device->Dry.Ambi.Map[i].Scale = 1.0f/n3dscale[acn];
device->Dry.Ambi.Map[i].Index = acn;
}
device->Dry.CoeffCount = 0;