aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-02-20 16:57:25 -0800
committerChris Robinson <[email protected]>2017-02-20 16:57:25 -0800
commitbb4726d52038befc53ab219da8b75193a2605c5d (patch)
tree743e8a8f4adcf6605c867d62f4ba6d20e3822299 /Alc/panning.c
parentf5e8a8c75e98e7a720a42a840701808b3f869a8a (diff)
Avoid duplicating device buffer layout logic
Diffstat (limited to 'Alc/panning.c')
-rw-r--r--Alc/panning.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index 52618a5e..70355b41 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -569,6 +569,7 @@ static void InitPanning(ALCdevice *device)
{
device->FOAOut.Ambi = device->Dry.Ambi;
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
+ device->FOAOut.NumChannels = 0;
}
else
{
@@ -582,6 +583,7 @@ static void InitPanning(ALCdevice *device)
device->FOAOut.Ambi.Map[i].Index = i;
}
device->FOAOut.CoeffCount = 0;
+ device->FOAOut.NumChannels = 4;
ambiup_reset(device->AmbiUp, device);
}
@@ -607,7 +609,9 @@ static void InitPanning(ALCdevice *device)
device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * xyz_scale;
}
device->FOAOut.CoeffCount = 4;
+ device->FOAOut.NumChannels = 0;
}
+ device->RealOut.NumChannels = 0;
}
static void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf, const ALsizei speakermap[MAX_OUTPUT_CHANNELS])
@@ -729,6 +733,9 @@ static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const A
device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * xyz_scale;
}
device->FOAOut.CoeffCount = 4;
+ device->FOAOut.NumChannels = 0;
+
+ device->RealOut.NumChannels = 0;
InitDistanceComp(device, conf, speakermap);
}
@@ -774,28 +781,36 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALsiz
{
device->FOAOut.Ambi = device->Dry.Ambi;
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
+ device->FOAOut.NumChannels = 0;
}
else
{
memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi));
if((conf->ChanMask&AMBI_PERIPHONIC_MASK))
- for(i = 0;i < 4;i++)
+ {
+ count = 4;
+ for(i = 0;i < count;i++)
{
device->FOAOut.Ambi.Map[i].Scale = 1.0f;
device->FOAOut.Ambi.Map[i].Index = i;
}
+ }
else
{
static const int map[3] = { 0, 1, 3 };
- for(i = 0;i < 3;i++)
+ count = 3;
+ for(i = 0;i < count;i++)
{
device->FOAOut.Ambi.Map[i].Scale = 1.0f;
device->FOAOut.Ambi.Map[i].Index = map[i];
}
}
device->FOAOut.CoeffCount = 0;
+ device->FOAOut.NumChannels = count;
}
+ device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans);
+
InitDistanceComp(device, conf, speakermap);
}
@@ -868,6 +883,7 @@ static void InitHrtfPanning(ALCdevice *device, bool hoa_mode)
{
device->FOAOut.Ambi = device->Dry.Ambi;
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
+ device->FOAOut.NumChannels = 0;
}
else
{
@@ -878,10 +894,13 @@ static void InitHrtfPanning(ALCdevice *device, bool hoa_mode)
device->FOAOut.Ambi.Map[i].Index = i;
}
device->FOAOut.CoeffCount = 0;
+ device->FOAOut.NumChannels = 4;
ambiup_reset(device->AmbiUp, device);
}
+ device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans);
+
memset(device->Hrtf.Coeffs, 0, sizeof(device->Hrtf.Coeffs));
device->Hrtf.IrSize = BuildBFormatHrtf(device->Hrtf.Handle,
device->Hrtf.Coeffs, device->Dry.NumChannels,
@@ -908,6 +927,9 @@ static void InitUhjPanning(ALCdevice *device)
device->FOAOut.Ambi = device->Dry.Ambi;
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
+ device->FOAOut.NumChannels = 0;
+
+ device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans);
}
void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf_appreq, enum HrtfRequestMode hrtf_userreq)