aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-01-30 03:33:02 -0800
committerChris Robinson <[email protected]>2016-01-30 07:10:36 -0800
commit729f213c09f7046554ba4aa05473c33edb3ee406 (patch)
treeabcab91214ecffcd88783b6c3a8ceda5b3478873 /Alc/ALu.c
parent7111322526f1dea7df987a843b8a42f4e746ccc4 (diff)
Fix scaling for effect sends of B-Format sources
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 70f686f3..d152b343 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -648,7 +648,8 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
aluNormalize(U);
/* Build a rotate + conversion matrix (B-Format -> N3D), and include
- * scaling for first-order content. */
+ * scaling for first-order content on second- or third-order output.
+ */
scale = Device->AmbiScale * 1.732050808f;
aluMatrixfSet(&matrix,
1.414213562f, 0.0f, 0.0f, 0.0f,
@@ -669,6 +670,14 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
UpdateDryStepping(&voice->Direct, num_channels, (voice->Direct.Moving ? 64 : 0));
voice->Direct.Moving = AL_TRUE;
+ /* Rebuild the matrix, without the second- or third-order output
+ * scaling (effects take first-order content, and will do the scaling
+ * themselves when mixing to the output).
+ */
+ scale = 1.732050808f;
+ aluMatrixfSetRow(&matrix, 1, 0.0f, -N[0]*scale, N[1]*scale, -N[2]*scale);
+ aluMatrixfSetRow(&matrix, 2, 0.0f, U[0]*scale, -U[1]*scale, U[2]*scale);
+ aluMatrixfSetRow(&matrix, 3, 0.0f, -V[0]*scale, V[1]*scale, -V[2]*scale);
for(i = 0;i < NumSends;i++)
{
if(!SendSlots[i])