aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-01-04 21:53:28 -0800
committerChris Robinson <[email protected]>2017-01-04 21:53:28 -0800
commitda4f0c65c303ac3cffb0fe4da240b7bec573009a (patch)
treee4e00d7b7f3763daf5c102f28c724f389748508a /Alc
parentfcdf1cea70027468e7a77301e9d6de5d28e3a547 (diff)
Update the B-Format HRTF coefficients to use the pseudo-inverse matrix
It's hard to tell which is ultimately better, although this way does make the FOA output somewhat louder which will help when it's combined with direct HRTF rendering.
Diffstat (limited to 'Alc')
-rw-r--r--Alc/hrtf.c40
1 files changed, 14 insertions, 26 deletions
diff --git a/Alc/hrtf.c b/Alc/hrtf.c
index b3b795ac..3249868d 100644
--- a/Alc/hrtf.c
+++ b/Alc/hrtf.c
@@ -158,23 +158,21 @@ ALuint BuildBFormatHrtf(const struct Hrtf *Hrtf, ALfloat (*coeffs)[HRIR_LENGTH][
{ DEG2RAD(-90.0f), DEG2RAD( 0.0f) },
};
static const ALfloat Ambi3DMatrix[14][2][MAX_AMBI_COEFFS] = {
- { { 0.078851598f, 0.000000000f, 0.070561967f, 0.000000000f }, { 0.0714285714f, 0.0000000000f, 0.1237180798f, 0.0000000000f } },
- { { 0.124051278f, 0.059847972f, 0.059847972f, 0.059847972f }, { 0.0714285714f, 0.0714285714f, 0.0714285714f, 0.0714285714f } },
- { { 0.124051278f, -0.059847972f, 0.059847972f, 0.059847972f }, { 0.0714285714f, -0.0714285714f, 0.0714285714f, 0.0714285714f } },
- { { 0.124051278f, -0.059847972f, 0.059847972f, -0.059847972f }, { 0.0714285714f, -0.0714285714f, 0.0714285714f, -0.0714285714f } },
- { { 0.124051278f, 0.059847972f, 0.059847972f, -0.059847972f }, { 0.0714285714f, 0.0714285714f, 0.0714285714f, -0.0714285714f } },
- { { 0.078851598f, 0.000000000f, 0.000000000f, 0.070561967f }, { 0.0714285714f, 0.0000000000f, 0.0000000000f, 0.1237180798f } },
- { { 0.078851598f, -0.070561967f, 0.000000000f, 0.000000000f }, { 0.0714285714f, -0.1237180798f, 0.0000000000f, 0.0000000000f } },
- { { 0.078851598f, 0.000000000f, 0.000000000f, -0.070561967f }, { 0.0714285714f, 0.0000000000f, 0.0000000000f, -0.1237180798f } },
- { { 0.078851598f, 0.070561967f, 0.000000000f, 0.000000000f }, { 0.0714285714f, 0.1237180798f, 0.0000000000f, 0.0000000000f } },
- { { 0.124051278f, 0.059847972f, -0.059847972f, 0.059847972f }, { 0.0714285714f, 0.0714285714f, -0.0714285714f, 0.0714285714f } },
- { { 0.124051278f, -0.059847972f, -0.059847972f, 0.059847972f }, { 0.0714285714f, -0.0714285714f, -0.0714285714f, 0.0714285714f } },
- { { 0.124051278f, -0.059847972f, -0.059847972f, -0.059847972f }, { 0.0714285714f, -0.0714285714f, -0.0714285714f, -0.0714285714f } },
- { { 0.124051278f, 0.059847972f, -0.059847972f, -0.059847972f }, { 0.0714285714f, 0.0714285714f, -0.0714285714f, -0.0714285714f } },
- { { 0.078851598f, 0.000000000f, -0.070561967f, 0.000000000f }, { 0.0714285714f, 0.0000000000f, -0.1237180798f, 0.0000000000f } },
+ { { 0.1889822365f, 0.0000000000f, 0.1889822365f, 0.0000000000f }, { 0.0714285714f, 0.0000000000f, 0.1237180798f, 0.0000000000f } },
+ { { 0.1889822365f, 0.1091089451f, 0.1091089451f, 0.1091089451f }, { 0.0714285714f, 0.0714285714f, 0.0714285714f, 0.0714285714f } },
+ { { 0.1889822365f, -0.1091089451f, 0.1091089451f, 0.1091089451f }, { 0.0714285714f, -0.0714285714f, 0.0714285714f, 0.0714285714f } },
+ { { 0.1889822365f, -0.1091089451f, 0.1091089451f, -0.1091089451f }, { 0.0714285714f, -0.0714285714f, 0.0714285714f, -0.0714285714f } },
+ { { 0.1889822365f, 0.1091089451f, 0.1091089451f, -0.1091089451f }, { 0.0714285714f, 0.0714285714f, 0.0714285714f, -0.0714285714f } },
+ { { 0.1889822365f, 0.0000000000f, 0.0000000000f, 0.1889822365f }, { 0.0714285714f, 0.0000000000f, 0.0000000000f, 0.1237180798f } },
+ { { 0.1889822365f, -0.1889822365f, 0.0000000000f, 0.0000000000f }, { 0.0714285714f, -0.1237180798f, 0.0000000000f, 0.0000000000f } },
+ { { 0.1889822365f, 0.0000000000f, 0.0000000000f, -0.1889822365f }, { 0.0714285714f, 0.0000000000f, 0.0000000000f, -0.1237180798f } },
+ { { 0.1889822365f, 0.1889822365f, 0.0000000000f, 0.0000000000f }, { 0.0714285714f, 0.1237180798f, 0.0000000000f, 0.0000000000f } },
+ { { 0.1889822365f, 0.1091089451f, -0.1091089451f, 0.1091089451f }, { 0.0714285714f, 0.0714285714f, -0.0714285714f, 0.0714285714f } },
+ { { 0.1889822365f, -0.1091089451f, -0.1091089451f, 0.1091089451f }, { 0.0714285714f, -0.0714285714f, -0.0714285714f, 0.0714285714f } },
+ { { 0.1889822365f, -0.1091089451f, -0.1091089451f, -0.1091089451f }, { 0.0714285714f, -0.0714285714f, -0.0714285714f, -0.0714285714f } },
+ { { 0.1889822365f, 0.1091089451f, -0.1091089451f, -0.1091089451f }, { 0.0714285714f, 0.0714285714f, -0.0714285714f, -0.0714285714f } },
+ { { 0.1889822365f, 0.0000000000f, -0.1889822365f, 0.0000000000f }, { 0.0714285714f, 0.0000000000f, -0.1237180798f, 0.0000000000f } },
};
-#define AMBIHF_GAIN 1.0f
-#define AMBILF_GAIN 0.553914423f /* -5.13dB */
/* Change this to 2 for dual-band HRTF processing. May require a higher quality
* band-splitter, or better calculation of the new IR length to deal with the
@@ -236,11 +234,6 @@ ALuint BuildBFormatHrtf(const struct Hrtf *Hrtf, ALfloat (*coeffs)[HRIR_LENGTH][
for(i = 0;i < Hrtf->irSize;i++)
temps[2][i] = fir[i] / 32767.0f;
bandsplit_process(&splitter, temps[0], temps[1], temps[2], HRIR_LENGTH);
- /* Scale the low and high frequency responses. */
- for(i = 0;i < HRIR_LENGTH;i++)
- temps[0][i] *= AMBIHF_GAIN;
- for(i = 0;i < HRIR_LENGTH;i++)
- temps[1][i] *= AMBILF_GAIN;
}
/* Add to the left output coefficients with the specified delay. */
@@ -270,11 +263,6 @@ ALuint BuildBFormatHrtf(const struct Hrtf *Hrtf, ALfloat (*coeffs)[HRIR_LENGTH][
for(i = 0;i < Hrtf->irSize;i++)
temps[2][i] = fir[i] / 32767.0f;
bandsplit_process(&splitter, temps[0], temps[1], temps[2], HRIR_LENGTH);
- /* Scale the low and high frequency responses. */
- for(i = 0;i < HRIR_LENGTH;i++)
- temps[0][i] *= AMBIHF_GAIN;
- for(i = 0;i < HRIR_LENGTH;i++)
- temps[1][i] *= AMBILF_GAIN;
}
/* Add to the right output coefficients with the specified delay. */