aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/panning.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index b49eb2e7..cb4406a8 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -852,30 +852,31 @@ static void InitHrtfPanning(ALCdevice *device)
{ 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f },
{ 5.55555556e-02f, 0.00000000e+00f, -1.23717915e-01f, 0.00000000e+00f },
}, AmbiMatrixHOA[][MAX_AMBI_COEFFS] = {
- { 5.55555556e-02f, 0.00000000e+00f, 1.23717915e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, 8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 1.29099445e-01f },
- { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f, -6.83467648e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, -8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.29099445e-01f },
- { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f, 6.83467648e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, -8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 1.29099445e-01f },
- { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f, -6.83467648e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, 8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.29099445e-01f },
- { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f, 6.83467648e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
- { 5.55555556e-02f, 0.00000000e+00f, -1.23717915e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
+ { 5.55555556e-02f, 0.00000000e+00f, 1.23717915e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
+ { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, 8.66025404e-02f, 0.00000000e+00f, 1.29099445e-01f },
+ { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f, -6.83467648e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, -8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.29099445e-01f },
+ { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f, 6.83467648e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, -8.66025404e-02f, 0.00000000e+00f, 1.29099445e-01f },
+ { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f, -6.83467648e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, 8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.29099445e-01f },
+ { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f, 6.83467648e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f },
+ { 5.55555556e-02f, 0.00000000e+00f, -1.23717915e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f },
};
static const ALfloat AmbiOrderHFGainFOA[MAX_AMBI_ORDER+1] = {
1.00000000e+00f, 5.77350269e-01f
}, AmbiOrderHFGainHOA[MAX_AMBI_ORDER+1] = {
9.80580676e-01f, 7.59554525e-01f, 3.92232270e-01f
};
+ static const ALsizei IndexMap[6] = { 0, 1, 2, 3, 4, 8 };
const ALfloat (*restrict AmbiMatrix)[MAX_AMBI_COEFFS] = AmbiMatrixFOA;
const ALfloat *restrict AmbiOrderHFGain = AmbiOrderHFGainFOA;
ALsizei count = 4;
@@ -889,7 +890,7 @@ static void InitHrtfPanning(ALCdevice *device)
{
AmbiMatrix = AmbiMatrixHOA;
AmbiOrderHFGain = AmbiOrderHFGainHOA;
- count = 9;
+ count = COUNTOF(IndexMap);
}
device->Hrtf = al_calloc(16, FAM_SIZE(DirectHrtfState, Chan, count));
@@ -897,7 +898,7 @@ static void InitHrtfPanning(ALCdevice *device)
for(i = 0;i < count;i++)
{
device->Dry.Ambi.Map[i].Scale = 1.0f;
- device->Dry.Ambi.Map[i].Index = i;
+ device->Dry.Ambi.Map[i].Index = IndexMap[i];
}
device->Dry.CoeffCount = 0;
device->Dry.NumChannels = count;
@@ -930,7 +931,22 @@ static void InitHrtfPanning(ALCdevice *device)
AmbiOrderHFGain
);
- InitNearFieldCtrl(device, device->HrtfHandle->distance, device->AmbiUp ? 2 : 1, true);
+ if(GetConfigValueBool(alstr_get_cstr(device->DeviceName), "decoder", "nfc", 1) &&
+ device->HrtfHandle->distance > 0.0f)
+ {
+ /* NFC is only used when AvgSpeakerDist is greater than 0, and can only
+ * be used when rendering to an ambisonic buffer.
+ */
+ device->AvgSpeakerDist = device->HrtfHandle->distance;
+
+ i = 0;
+ device->Dry.NumChannelsPerOrder[i++] = 1;
+ device->Dry.NumChannelsPerOrder[i++] = 3;
+ if(device->AmbiUp)
+ device->Dry.NumChannelsPerOrder[i++] = 2;
+ while(i < MAX_AMBI_ORDER+1)
+ device->Dry.NumChannelsPerOrder[i++] = 0;
+ }
}
static void InitUhjPanning(ALCdevice *device)