aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2015-08-28 10:58:30 -0700
committerChris Robinson <[email protected]>2015-08-28 10:58:30 -0700
commitbbc16e2c15b139cf2ef14eff9b3bcdb4933a5b0e (patch)
tree7cd24d9ad9fee9560dd44a5f9475ea7c9b818171 /Alc/ALu.c
parentd17534332f528a97c633d0a955fc50b3eabdfbeb (diff)
Use ACN ordering for ambisonics coefficients arrays
Note that it still uses FuMa scalings internally. Coefficients loaded from config files specify if they're FuMa (in both ordering and scaling) or N3D, and will get reordered or rescaled as needed.
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 822189f8..14b4d134 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -492,6 +492,7 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
{
ALfloat N[3], V[3], U[3];
aluMatrix matrix;
+ ALfloat scale;
/* AT then UP */
N[0] = ALSource->Orientation[0][0];
@@ -512,11 +513,14 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
aluCrossproduct(N, V, U);
aluNormalize(U);
+ /* Build a rotate + channel reorder matrix (B-Format -> ACN), and
+ * include scaling for first-order content. */
+ scale = Device->AmbiScale;
aluMatrixSet(&matrix,
- 1.0f, 0.0f, 0.0f, 0.0f,
- 0.0f, -N[2], -N[0], N[1],
- 0.0f, U[2], U[0], -U[1],
- 0.0f, -V[2], -V[0], V[1]
+ 1.0f, 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
);
for(c = 0;c < num_channels;c++)