diff options
author | Chris Robinson <[email protected]> | 2016-01-28 00:02:46 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-01-28 00:02:46 -0800 |
commit | c1f87414c5452f595f78b7a52a7063a023ce2982 (patch) | |
tree | 7a8b3007d1cf3ff7b05edc45c5ac7962c3dbbbaf /OpenAL32/Include/alAuxEffectSlot.h | |
parent | 2fa3ae85c9a4050eab3a4f140fb6accd0a02ce85 (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 'OpenAL32/Include/alAuxEffectSlot.h')
-rw-r--r-- | OpenAL32/Include/alAuxEffectSlot.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/OpenAL32/Include/alAuxEffectSlot.h b/OpenAL32/Include/alAuxEffectSlot.h index bbb112be..3f677fd1 100644 --- a/OpenAL32/Include/alAuxEffectSlot.h +++ b/OpenAL32/Include/alAuxEffectSlot.h @@ -64,6 +64,9 @@ static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = } +#define MAX_EFFECT_CHANNELS (4) + + typedef struct ALeffectslot { ALenum EffectType; ALeffectProps EffectProps; @@ -74,12 +77,24 @@ typedef struct ALeffectslot { ATOMIC(ALenum) NeedsUpdate; ALeffectState *EffectState; - alignas(16) ALfloat WetBuffer[1][BUFFERSIZE]; - RefCount ref; /* Self ID */ ALuint id; + + ALuint NumChannels; + ChannelConfig AmbiCoeffs[MAX_EFFECT_CHANNELS]; + /* Wet buffer configuration is ACN channel order with N3D scaling: + * * Channel 0 is the unattenuated mono signal. + * * Channel 1 is OpenAL -X + * * Channel 2 is OpenAL Y + * * Channel 3 is OpenAL -Z + * Consequently, effects that only want to work with mono input can use + * channel 0 by itself. Effects that want multichannel can process the + * ambisonics signal and create a B-Format pan (ComputeBFormatGains) for + * the device output. + */ + alignas(16) ALfloat WetBuffer[MAX_EFFECT_CHANNELS][BUFFERSIZE]; } ALeffectslot; inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) |