aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-01-28 00:02:46 -0800
committerChris Robinson <[email protected]>2016-01-28 00:02:46 -0800
commitc1f87414c5452f595f78b7a52a7063a023ce2982 (patch)
tree7a8b3007d1cf3ff7b05edc45c5ac7962c3dbbbaf /Alc/panning.c
parent2fa3ae85c9a4050eab3a4f140fb6accd0a02ce85 (diff)
Mix to multichannel for effects
This mixes to a 4-channel first-order ambisonics buffer. With ACN ordering and N3D scaling, this makes it easy to remain compatible with effects that only care about mono input since channel 0 is an unattenuated mono signal.
Diffstat (limited to 'Alc/panning.c')
-rw-r--r--Alc/panning.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index dccb495e..c4eb3f82 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -27,8 +27,7 @@
#include <assert.h>
#include "alMain.h"
-#include "AL/al.h"
-#include "AL/alc.h"
+#include "alAuxEffectSlot.h"
#include "alu.h"
#include "bool.h"
@@ -569,3 +568,22 @@ ALvoid aluInitPanning(ALCdevice *device)
&device->NumChannels, AL_TRUE);
device->AmbiScale = ambiscale;
}
+
+void aluInitEffectPanning(ALeffectslot *slot)
+{
+ static const ChannelMap FirstOrderN3D[4] = {
+ { BFormatW, { 1.0f, 0.0f, 0.0f, 0.0f } },
+ { BFormatY, { 0.0f, 1.0f, 0.0f, 0.0f } },
+ { BFormatZ, { 0.0f, 0.0f, 1.0f, 0.0f } },
+ { BFormatX, { 0.0f, 0.0f, 0.0f, 1.0f } },
+ };
+ static const enum Channel AmbiChannels[MAX_OUTPUT_CHANNELS] = {
+ BFormatW, BFormatY, BFormatZ, BFormatX, InvalidChannel
+ };
+
+ memset(slot->AmbiCoeffs, 0, sizeof(slot->AmbiCoeffs));
+ slot->NumChannels = 0;
+
+ SetChannelMap(AmbiChannels, slot->AmbiCoeffs, FirstOrderN3D, COUNTOF(FirstOrderN3D),
+ &slot->NumChannels, AL_FALSE);
+}