aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-03-25 08:24:53 -0700
committerChris Robinson <[email protected]>2018-03-25 08:24:53 -0700
commitf3672ab26b47763bcb8ef3f910062943319710a5 (patch)
tree2c0f43df2ab291cfb231f14ec1acfde0f7ab3844
parentf757fbce4dc4b57cd3c8818957df125c25621c43 (diff)
Annotate the B-Format rotation/conversion matrix
-rw-r--r--Alc/ALu.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index c70a7162..c670fa5e 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -684,9 +684,10 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
/* Local B-Format sources have their XYZ channels rotated according
* to the orientation.
*/
+ const ALfloat sqrt_2 = sqrtf(2.0f);
+ const ALfloat sqrt_3 = sqrtf(3.0f);
ALfloat N[3], V[3], U[3];
aluMatrixf matrix;
- ALfloat scale;
if(Device->AvgSpeakerDist > 0.0f)
{
@@ -722,13 +723,16 @@ static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Distance, const
aluCrossproduct(N, V, U);
aluNormalize(U);
- /* Build a rotate + conversion matrix (FuMa -> ACN+N3D). */
- scale = 1.732050808f;
+ /* Build a rotate + conversion matrix (FuMa -> ACN+N3D). NOTE: This
+ * matrix is transposed, for the inputs to align on the rows and
+ * outputs on the columns.
+ */
aluMatrixfSet(&matrix,
- 1.414213562f, 0.0f, 0.0f, 0.0f,
- 0.0f, -N[0]*scale, N[1]*scale, -N[2]*scale,
- 0.0f, U[0]*scale, -U[1]*scale, U[2]*scale,
- 0.0f, -V[0]*scale, V[1]*scale, -V[2]*scale
+ // ACN0 ACN1 ACN2 ACN3
+ sqrt_2, 0.0f, 0.0f, 0.0f, // Ambi W
+ 0.0f, -N[0]*sqrt_3, N[1]*sqrt_3, -N[2]*sqrt_3, // Ambi X
+ 0.0f, U[0]*sqrt_3, -U[1]*sqrt_3, U[2]*sqrt_3, // Ambi Y
+ 0.0f, -V[0]*sqrt_3, V[1]*sqrt_3, -V[2]*sqrt_3 // Ambi Z
);
voice->Direct.Buffer = Device->FOAOut.Buffer;