aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-08-18 07:44:17 -0700
committerChris Robinson <[email protected]>2015-08-18 07:44:17 -0700
commit6f59ebab279c67247def10effbea284df030ae6c (patch)
tree0a6537d28134d252e08444aa795ea9fd4fb13083 /Alc
parent53f6590b17fba8f9de7bdc1a349e9787217d9c85 (diff)
Don't explicitly store first-order coefficients
It seems a simple scaling on the coefficients will allow first-order content to work with second- and third-order coefficients, although obviously not with any improved locality. That may be something to look into for the future, but this is good enough for now.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/panning.c174
1 files changed, 114 insertions, 60 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index 92dc6adf..bf186da4 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -33,6 +33,11 @@
#include "bool.h"
+#define ZERO_ORDER_SCALE 0.0f
+#define FIRST_ORDER_SCALE 1.0f
+#define SECOND_ORDER_SCALE (1.0f / 1.22474f)
+#define THIRD_ORDER_SCALE (1.0f / 1.30657f)
+
void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat elevation, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS])
{
ALfloat dir[3] = {
@@ -74,7 +79,7 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl
for(i = 0;i < device->NumChannels;i++)
{
for(j = 0;j < MAX_AMBI_COEFFS;j++)
- gains[i] += device->Channel[i].HOACoeff[j]*coeffs[j];
+ gains[i] += device->AmbiCoeffs[i][j]*coeffs[j];
gains[i] *= ingain;
}
}
@@ -92,7 +97,7 @@ void ComputeAmbientGains(const ALCdevice *device, ALfloat ingain, ALfloat gains[
// scaling the W channel input by sqrt(0.5). The square root of the
// base average provides for a more perceptual average volume, better
// suited to non-directional gains.
- gains[i] = sqrtf(device->Channel[i].HOACoeff[0]/1.4142f) * ingain;
+ gains[i] = sqrtf(device->AmbiCoeffs[i][0]/1.4142f) * ingain;
}
}
@@ -104,8 +109,10 @@ void ComputeBFormatGains(const ALCdevice *device, const ALfloat mtx[4], ALfloat
gains[i] = 0.0f;
for(i = 0;i < device->NumChannels;i++)
{
- for(j = 0;j < 4;j++)
- gains[i] += device->Channel[i].FOACoeff[j] * mtx[j];
+ float scale = device->AmbiScale;
+ gains[i] += device->AmbiCoeffs[i][0] * mtx[0];
+ for(j = 1;j < 4;j++)
+ gains[i] += device->AmbiCoeffs[i][j] * scale * mtx[j];
gains[i] *= ingain;
}
}
@@ -150,18 +157,17 @@ typedef struct ChannelMap {
ChannelConfig Config;
} ChannelMap;
-static void SetChannelMap(ALCdevice *device, const ChannelMap *chanmap, size_t count)
+static void SetChannelMap(ALCdevice *device, const ChannelMap *chanmap, size_t count, ALfloat ambiscale)
{
size_t i, j;
+ device->AmbiScale = ambiscale;
for(i = 0;i < MAX_OUTPUT_CHANNELS && device->ChannelName[i] != InvalidChannel;i++)
{
if(device->ChannelName[i] == LFE)
{
for(j = 0;j < MAX_AMBI_COEFFS;j++)
- device->Channel[i].HOACoeff[j] = 0.0f;
- for(j = 0;j < 4;j++)
- device->Channel[i].FOACoeff[j] = 0.0f;
+ device->AmbiCoeffs[i][j] = 0.0f;
continue;
}
@@ -169,7 +175,9 @@ static void SetChannelMap(ALCdevice *device, const ChannelMap *chanmap, size_t c
{
if(device->ChannelName[i] == chanmap[j].ChanName)
{
- device->Channel[i] = chanmap[j].Config;
+ size_t k;
+ for(k = 0;k < MAX_AMBI_COEFFS;++k)
+ device->AmbiCoeffs[i][k] = chanmap[j].Config[k];
break;
}
}
@@ -206,7 +214,9 @@ static bool LoadChannelSetup(ALCdevice *device)
ChannelMap chanmap[MAX_OUTPUT_CHANNELS];
const enum Channel *channels = NULL;
const char *layout = NULL;
+ ALfloat ambiscale = 1.0f;
size_t count = 0;
+ int order;
size_t i;
switch(device->FmtChans)
@@ -255,9 +265,22 @@ static bool LoadChannelSetup(ALCdevice *device)
else
{
char name[32];
- snprintf(name, sizeof(name), "%s/enable", layout);
- if(!GetConfigValueBool("layouts", name, 0))
+ snprintf(name, sizeof(name), "%s/order", layout);
+ if(!ConfigValueInt("layouts", name, &order))
+ return false;
+ if(order == 3)
+ ambiscale = THIRD_ORDER_SCALE;
+ else if(order == 2)
+ ambiscale = SECOND_ORDER_SCALE;
+ else if(order == 1)
+ ambiscale = FIRST_ORDER_SCALE;
+ else if(order == 0)
+ ambiscale = ZERO_ORDER_SCALE;
+ else
+ {
+ ERR("Unhandled order value %d (expected 0, 1, 2, or 3) for layout %s\n", order, name);
return false;
+ }
}
for(i = 0;i < count;i++)
@@ -265,7 +288,9 @@ static bool LoadChannelSetup(ALCdevice *device)
const char *channame;
char chanlayout[32];
const char *value;
- int props;
+ int props = 0;
+ char eol = 0;
+ int j;
chanmap[i].ChanName = channels[i];
channame = GetLabelFromChannel(channels[i]);
@@ -276,79 +301,99 @@ static bool LoadChannelSetup(ALCdevice *device)
ERR("Missing channel %s\n", channame);
return false;
}
- props = sscanf(value, " %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f ; %f %f %f %f",
- &chanmap[i].Config.HOACoeff[0], &chanmap[i].Config.HOACoeff[1], &chanmap[i].Config.HOACoeff[2],
- &chanmap[i].Config.HOACoeff[3], &chanmap[i].Config.HOACoeff[4], &chanmap[i].Config.HOACoeff[5],
- &chanmap[i].Config.HOACoeff[6], &chanmap[i].Config.HOACoeff[7], &chanmap[i].Config.HOACoeff[8],
- &chanmap[i].Config.HOACoeff[9], &chanmap[i].Config.HOACoeff[10], &chanmap[i].Config.HOACoeff[11],
- &chanmap[i].Config.HOACoeff[12], &chanmap[i].Config.HOACoeff[13], &chanmap[i].Config.HOACoeff[14],
- &chanmap[i].Config.HOACoeff[15], &chanmap[i].Config.FOACoeff[0], &chanmap[i].Config.FOACoeff[1],
- &chanmap[i].Config.FOACoeff[2], &chanmap[i].Config.FOACoeff[3]);
+ if(order == 3)
+ props = sscanf(value, " %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %c",
+ &chanmap[i].Config[0], &chanmap[i].Config[1], &chanmap[i].Config[2],
+ &chanmap[i].Config[3], &chanmap[i].Config[4], &chanmap[i].Config[5],
+ &chanmap[i].Config[6], &chanmap[i].Config[7], &chanmap[i].Config[8],
+ &chanmap[i].Config[9], &chanmap[i].Config[10], &chanmap[i].Config[11],
+ &chanmap[i].Config[12], &chanmap[i].Config[13], &chanmap[i].Config[14],
+ &chanmap[i].Config[15], &eol
+ );
+ else if(order == 2)
+ props = sscanf(value, " %f %f %f %f %f %f %f %f %f %c",
+ &chanmap[i].Config[0], &chanmap[i].Config[1], &chanmap[i].Config[2],
+ &chanmap[i].Config[3], &chanmap[i].Config[4], &chanmap[i].Config[5],
+ &chanmap[i].Config[6], &chanmap[i].Config[7], &chanmap[i].Config[8],
+ &eol
+ );
+ else if(order == 1)
+ props = sscanf(value, " %f %f %f %f %c",
+ &chanmap[i].Config[0], &chanmap[i].Config[1], &chanmap[i].Config[2],
+ &chanmap[i].Config[3], &eol
+ );
+ else if(order == 0)
+ props = sscanf(value, " %f %c", &chanmap[i].Config[0], &eol);
if(props == 0)
{
ERR("Failed to parse %s channel's properties\n", channame);
return false;
}
- if(props < 20)
+ if(props > (order+1)*(order+1))
{
- ERR("Failed to parse %s channel's elements (expected 20, got %d)\n", channame, props);
+ ERR("Excess elements in %s channel %s (expected %d)\n", layout, channame, (order+1)*(order+1));
return false;
}
+
+ for(j = props;j < 16;++j)
+ chanmap[i].Config[j] = 0.0f;
}
- SetChannelMap(device, chanmap, count);
+ SetChannelMap(device, chanmap, count, ambiscale);
return true;
}
ALvoid aluInitPanning(ALCdevice *device)
{
static const ChannelMap MonoCfg[1] = {
- { FrontCenter, { { 1.4142f }, { 1.4142f } } },
+ { FrontCenter, { 1.4142f } },
}, StereoCfg[2] = {
- { FrontLeft, { { 0.7071f, 0.0f, 0.5f, 0.0f }, { 0.7071f, 0.0f, 0.5f, 0.0f } } },
- { FrontRight, { { 0.7071f, 0.0f, -0.5f, 0.0f }, { 0.7071f, 0.0f, -0.5f, 0.0f } } },
+ { FrontLeft, { 0.7071f, 0.0f, 0.5f, 0.0f } },
+ { FrontRight, { 0.7071f, 0.0f, -0.5f, 0.0f } },
}, QuadCfg[4] = {
- { FrontLeft, { { 0.353558f, 0.306181f, 0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.117183f }, { 0.353553f, 0.250000f, 0.250000f, 0.0f } } },
- { FrontRight, { { 0.353558f, 0.306181f, -0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.117183f }, { 0.353553f, 0.250000f, -0.250000f, 0.0f } } },
- { BackLeft, { { 0.353543f, -0.306192f, 0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.117193f }, { 0.353553f, -0.250000f, 0.250000f, 0.0f } } },
- { BackRight, { { 0.353543f, -0.306192f, -0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.117193f }, { 0.353553f, -0.250000f, -0.250000f, 0.0f } } },
+ { FrontLeft, { 0.353553f, 0.306184f, 0.306184f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.117186f } },
+ { FrontRight, { 0.353553f, 0.306184f, -0.306184f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.117186f } },
+ { BackLeft, { 0.353553f, -0.306184f, 0.306184f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.117186f } },
+ { BackRight, { 0.353553f, -0.306184f, -0.306184f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.117186f } },
}, X51SideCfg[5] = {
- { FrontLeft, { { 0.208954f, 0.212846f, 0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, 0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, 0.047490f }, { 0.208954f, 0.162905f, 0.182425f, 0.0f } } },
- { FrontRight, { { 0.208954f, 0.212846f, -0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, -0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, -0.047490f }, { 0.208954f, 0.162905f, -0.182425f, 0.0f } } },
- { FrontCenter, { { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } } },
- { SideLeft, { { 0.470936f, -0.369626f, 0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, -0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, -0.043968f }, { 0.470934f, -0.282903f, 0.267406f, 0.0f } } },
- { SideRight, { { 0.470936f, -0.369626f, -0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, 0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, 0.043968f }, { 0.470934f, -0.282903f, -0.267406f, 0.0f } } },
+ { FrontLeft, { 0.208954f, 0.212846f, 0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, 0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, 0.047490f } },
+ { FrontRight, { 0.208954f, 0.212846f, -0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, -0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, -0.047490f } },
+ { FrontCenter, { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f } },
+ { SideLeft, { 0.470936f, -0.369626f, 0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, -0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, -0.043968f } },
+ { SideRight, { 0.470936f, -0.369626f, -0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, 0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, 0.043968f } },
}, X51RearCfg[5] = {
- { FrontLeft, { { 0.208954f, 0.212846f, 0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, 0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, 0.047490f }, { 0.208954f, 0.162905f, 0.182425f, 0.0f } } },
- { FrontRight, { { 0.208954f, 0.212846f, -0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, -0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, -0.047490f }, { 0.208954f, 0.162905f, -0.182425f, 0.0f } } },
- { FrontCenter, { { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } } },
- { BackLeft, { { 0.470936f, -0.369626f, 0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, -0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, -0.043968f }, { 0.470934f, -0.282903f, 0.267406f, 0.0f } } },
- { BackRight, { { 0.470936f, -0.369626f, -0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, 0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, 0.043968f }, { 0.470934f, -0.282903f, -0.267406f, 0.0f } } },
+ { FrontLeft, { 0.208954f, 0.212846f, 0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, 0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, 0.047490f } },
+ { FrontRight, { 0.208954f, 0.212846f, -0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, -0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, -0.047490f } },
+ { FrontCenter, { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f } },
+ { BackLeft, { 0.470936f, -0.369626f, 0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, -0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, -0.043968f } },
+ { BackRight, { 0.470936f, -0.369626f, -0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, 0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, 0.043968f } },
}, X61Cfg[6] = {
- { FrontLeft, { { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f }, { 0.167065f, 0.153519f, 0.132175f, 0.0f } } },
- { FrontRight, { { 0.167065f, 0.200583f, -0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, -0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068910f }, { 0.167065f, 0.153519f, -0.132175f, 0.0f } } },
- { FrontCenter, { { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } } },
- { BackCenter, { { 0.353556f, -0.461940f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.165723f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.000000f }, { 0.353556f, -0.353554f, 0.000000f, 0.0f } } },
- { SideLeft, { { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f }, { 0.289151f, -0.062225f, 0.307136f, 0.0f } } },
- { SideRight, { { 0.289151f, -0.081301f, -0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f }, { 0.289151f, -0.062225f, -0.307136f, 0.0f } } },
+ { FrontLeft, { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } },
+ { FrontRight, { 0.167065f, 0.200583f, -0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, -0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068910f } },
+ { FrontCenter, { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f } },
+ { BackCenter, { 0.353556f, -0.461940f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.165723f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.000000f } },
+ { SideLeft, { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f } },
+ { SideRight, { 0.289151f, -0.081301f, -0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f } },
}, X71Cfg[7] = {
- { FrontLeft, { { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f }, { 0.167065f, 0.153519f, 0.132175f, 0.0f } } },
- { FrontRight, { { 0.167065f, 0.200583f, -0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, -0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068910f }, { 0.167065f, 0.153519f, -0.132175f, 0.0f } } },
- { FrontCenter, { { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } } },
- { BackLeft, { { 0.224752f, -0.295009f, 0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, -0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065799f }, { 0.224752f, -0.225790f, 0.130361f, 0.0f } } },
- { BackRight, { { 0.224752f, -0.295009f, -0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, 0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065799f }, { 0.224752f, -0.225790f, -0.130361f, 0.0f } } },
- { SideLeft, { { 0.224739f, 0.000000f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065795f }, { 0.224739f, 0.000000f, 0.260717f, 0.0f } } },
- { SideRight, { { 0.224739f, 0.000000f, -0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065795f }, { 0.224739f, 0.000000f, -0.260717f, 0.0f } } },
+ { FrontLeft, { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } },
+ { FrontRight, { 0.167065f, 0.200583f, -0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, -0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068910f } },
+ { FrontCenter, { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f } },
+ { BackLeft, { 0.224752f, -0.295009f, 0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, -0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065799f } },
+ { BackRight, { 0.224752f, -0.295009f, -0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, 0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065799f } },
+ { SideLeft, { 0.224739f, 0.000000f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065795f } },
+ { SideRight, { 0.224739f, 0.000000f, -0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065795f } },
}, BFormat3D[4] = {
- { Aux0, { { 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f } } },
- { Aux1, { { 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f } } },
- { Aux2, { { 0.0f, 0.0f, 1.0f, 0.0f }, { 0.0f, 0.0f, 1.0f, 0.0f } } },
- { Aux3, { { 0.0f, 0.0f, 0.0f, 1.0f }, { 0.0f, 0.0f, 0.0f, 1.0f } } },
+ { Aux0, { 1.0f, 0.0f, 0.0f, 0.0f } },
+ { Aux1, { 0.0f, 1.0f, 0.0f, 0.0f } },
+ { Aux2, { 0.0f, 0.0f, 1.0f, 0.0f } },
+ { Aux3, { 0.0f, 0.0f, 0.0f, 1.0f } },
};
const ChannelMap *chanmap = NULL;
+ ALfloat ambiscale = 1.0f;
size_t count = 0;
- memset(device->Channel, 0, sizeof(device->Channel));
+ device->AmbiScale = 1.0f;
+ memset(device->AmbiCoeffs, 0, sizeof(device->AmbiCoeffs));
device->NumChannels = 0;
if(device->Hrtf)
@@ -357,12 +402,13 @@ ALvoid aluInitPanning(ALCdevice *device)
count = COUNTOF(BFormat3D);
chanmap = BFormat3D;
+ ambiscale = 1.0f;
for(i = 0;i < count;i++)
device->ChannelName[i] = chanmap[i].ChanName;
for(;i < MAX_OUTPUT_CHANNELS;i++)
device->ChannelName[i] = InvalidChannel;
- SetChannelMap(device, chanmap, count);
+ SetChannelMap(device, chanmap, count, ambiscale);
{
ALfloat (*coeffs_list[4])[2] = {
@@ -387,43 +433,51 @@ ALvoid aluInitPanning(ALCdevice *device)
case DevFmtMono:
count = COUNTOF(MonoCfg);
chanmap = MonoCfg;
+ ambiscale = ZERO_ORDER_SCALE;
break;
case DevFmtStereo:
count = COUNTOF(StereoCfg);
chanmap = StereoCfg;
+ ambiscale = FIRST_ORDER_SCALE;
break;
case DevFmtQuad:
count = COUNTOF(QuadCfg);
chanmap = QuadCfg;
+ ambiscale = SECOND_ORDER_SCALE;
break;
case DevFmtX51:
count = COUNTOF(X51SideCfg);
chanmap = X51SideCfg;
+ ambiscale = THIRD_ORDER_SCALE;
break;
case DevFmtX51Rear:
count = COUNTOF(X51RearCfg);
chanmap = X51RearCfg;
+ ambiscale = THIRD_ORDER_SCALE;
break;
case DevFmtX61:
count = COUNTOF(X61Cfg);
chanmap = X61Cfg;
+ ambiscale = THIRD_ORDER_SCALE;
break;
case DevFmtX71:
count = COUNTOF(X71Cfg);
chanmap = X71Cfg;
+ ambiscale = THIRD_ORDER_SCALE;
break;
case DevFmtBFormat3D:
count = COUNTOF(BFormat3D);
chanmap = BFormat3D;
+ ambiscale = 1.0f;
break;
}
- SetChannelMap(device, chanmap, count);
+ SetChannelMap(device, chanmap, count, ambiscale);
}