aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Alc/ALc.c20
-rw-r--r--Alc/ALu.c33
-rw-r--r--Alc/mixer.c17
-rw-r--r--Alc/panning.c75
-rw-r--r--OpenAL32/Include/alBuffer.h4
-rw-r--r--OpenAL32/Include/alMain.h3
-rw-r--r--OpenAL32/Include/alu.h8
-rw-r--r--OpenAL32/alBuffer.c28
8 files changed, 148 insertions, 40 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index 781e0729..7763f501 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -497,6 +497,12 @@ static const ALCenums enumeration[] = {
DECL(AL_7POINT1_8_SOFT),
DECL(AL_7POINT1_16_SOFT),
DECL(AL_7POINT1_32F_SOFT),
+ DECL(AL_FORMAT_BFORMAT2D_8),
+ DECL(AL_FORMAT_BFORMAT2D_16),
+ DECL(AL_FORMAT_BFORMAT2D_FLOAT32),
+ DECL(AL_FORMAT_BFORMAT3D_8),
+ DECL(AL_FORMAT_BFORMAT3D_16),
+ DECL(AL_FORMAT_BFORMAT3D_FLOAT32),
DECL(AL_MONO_SOFT),
DECL(AL_STEREO_SOFT),
@@ -714,13 +720,13 @@ static ALCchar *alcCaptureDefaultDeviceSpecifier;
/* Default context extensions */
static const ALchar alExtList[] =
- "AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 "
- "AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW "
- "AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model "
- "AL_LOKI_quadriphonic AL_SOFT_block_alignment AL_SOFT_buffer_samples "
- "AL_SOFT_buffer_sub_data AL_SOFT_deferred_updates AL_SOFT_direct_channels "
- "AL_SOFT_loop_points AL_SOFT_MSADPCM AL_SOFT_source_latency "
- "AL_SOFT_source_length";
+ "AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE "
+ "AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS "
+ "AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET "
+ "AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_block_alignment "
+ "AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFT_deferred_updates "
+ "AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_MSADPCM "
+ "AL_SOFT_source_latency AL_SOFT_source_length";
static ATOMIC(ALCenum) LastNullDeviceError = ATOMIC_INIT_STATIC(ALC_NO_ERROR);
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 5af26182..a55fc485 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -291,6 +291,7 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
const struct ChanMap *chans = NULL;
ALuint num_channels = 0;
ALboolean DirectChannels;
+ ALboolean isbformat = AL_FALSE;
ALfloat Pitch;
ALuint i, j, c;
@@ -399,9 +400,39 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A
chans = X71Map;
num_channels = 8;
break;
+
+ case FmtBFormat2D:
+ num_channels = 3;
+ isbformat = AL_TRUE;
+ DirectChannels = AL_FALSE;
+
+ case FmtBFormat3D:
+ num_channels = 4;
+ isbformat = AL_TRUE;
+ DirectChannels = AL_FALSE;
}
- if(DirectChannels != AL_FALSE)
+ if(isbformat)
+ {
+ for(c = 0;c < num_channels;c++)
+ {
+ MixGains *gains = voice->Direct.Mix.Gains[c];
+ ALfloat Target[MaxChannels];
+
+ ComputeBFormatGains(Device, c, DryGain, Target);
+ for(i = 0;i < MaxChannels;i++)
+ gains[i].Target = Target[i];
+ }
+ /* B-Format cannot handle logarithmic gain stepping, since the gain can
+ * switch between positive and negative values. */
+ voice->Direct.Moving = AL_FALSE;
+ UpdateDryStepping(&voice->Direct, num_channels);
+
+ voice->IsHrtf = AL_FALSE;
+ for(i = 0;i < NumSends;i++)
+ WetGain[i] *= 1.4142f;
+ }
+ else if(DirectChannels != AL_FALSE)
{
for(c = 0;c < num_channels;c++)
{
diff --git a/Alc/mixer.c b/Alc/mixer.c
index 1cc3fe9d..762fc7fe 100644
--- a/Alc/mixer.c
+++ b/Alc/mixer.c
@@ -185,6 +185,7 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
ResamplerFunc Resample;
ALbufferlistitem *BufferListItem;
ALuint DataPosInt, DataPosFrac;
+ ALboolean isbformat = AL_FALSE;
ALboolean Looping;
ALuint increment;
enum Resampler Resampler;
@@ -206,6 +207,18 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
NumChannels = Source->NumChannels;
SampleSize = Source->SampleSize;
+ while(BufferListItem)
+ {
+ ALbuffer *buffer;
+ if((buffer=BufferListItem->buffer) != NULL)
+ {
+ isbformat = (buffer->FmtChannels == FmtBFormat2D ||
+ buffer->FmtChannels == FmtBFormat3D);
+ break;
+ }
+ BufferListItem = BufferListItem->next;
+ }
+
Mix = SelectMixer();
HrtfMix = SelectHrtfMixer();
Resample = SelectResampler(Resampler, increment);
@@ -428,6 +441,10 @@ ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint Sam
&parms->Mix.Hrtf.State[chan], DstBufferSize);
}
+ /* Only the first channel for B-Format buffers (W channel) goes to
+ * the send paths. */
+ if(chan > 0 && isbformat)
+ continue;
for(j = 0;j < Device->NumAuxSends;j++)
{
SendParams *parms = &voice->Send[j];
diff --git a/Alc/panning.c b/Alc/panning.c
index e73c99aa..85de3626 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -76,51 +76,64 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl
{
enum Channel chan = device->Speaker[i].ChanName;
for(j = 0;j < MAX_AMBI_COEFFS;j++)
- gains[chan] += device->Speaker[i].Coeff[j]*coeffs[j];
+ gains[chan] += device->Speaker[i].HOACoeff[j]*coeffs[j];
gains[chan] = maxf(gains[chan], 0.0f) * ingain;
}
}
+void ComputeBFormatGains(const ALCdevice *device, ALuint channum, ALfloat ingain, ALfloat gains[MaxChannels])
+{
+ ALuint i;
+
+ for(i = 0;i < MaxChannels;i++)
+ gains[i] = 0.0f;
+ for(i = 0;i < device->NumSpeakers;i++)
+ {
+ enum Channel chan = device->Speaker[i].ChanName;
+ gains[chan] = device->Speaker[i].FOACoeff[channum] * ingain;
+ }
+}
+
ALvoid aluInitPanning(ALCdevice *device)
{
static const ChannelConfig MonoCfg[1] = {
- { FrontCenter, DEG2RAD(0.0f), DEG2RAD(0.0f), { 1.4142f } }
+ { FrontCenter, DEG2RAD(0.0f), DEG2RAD(0.0f), { 1.4142f }, { 1.4142f } }
}, StereoCfg[2] = {
- { FrontLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.7071f, 0.0f, 0.5f, 0.0f } },
- { FrontRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.7071f, 0.0f, -0.5f, 0.0f } }
+ { FrontLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.7071f, 0.0f, 0.5f, 0.0f }, { 0.7071f, 0.0f, 0.5f, 0.0f } },
+ { FrontRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.7071f, 0.0f, -0.5f, 0.0f }, { 0.7071f, 0.0f, -0.5f, 0.0f } }
}, QuadCfg[4] = {
- { FrontLeft, DEG2RAD( -45.0f), DEG2RAD(0.0f), { 0.353558f, 0.306181f, 0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.117183f } },
- { FrontRight, DEG2RAD( 45.0f), DEG2RAD(0.0f), { 0.353543f, 0.306181f, -0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.117193f } },
- { BackLeft, DEG2RAD(-135.0f), DEG2RAD(0.0f), { 0.353543f, -0.306192f, 0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.117193f } },
- { BackRight, DEG2RAD( 135.0f), DEG2RAD(0.0f), { 0.353558f, -0.306192f, -0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.117183f } }
+ { FrontLeft, DEG2RAD( -45.0f), DEG2RAD(0.0f), { 0.353558f, 0.306181f, 0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.117183f }, { 0.353553f, 0.250000f, 0.250000f, 0.0f } },
+ { FrontRight, DEG2RAD( 45.0f), DEG2RAD(0.0f), { 0.353543f, 0.306181f, -0.306192f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.117193f }, { 0.353553f, 0.250000f, -0.250000f, 0.0f } },
+ { BackLeft, DEG2RAD(-135.0f), DEG2RAD(0.0f), { 0.353543f, -0.306192f, 0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.117193f }, { 0.353553f, -0.250000f, 0.250000f, 0.0f } },
+ { BackRight, DEG2RAD( 135.0f), DEG2RAD(0.0f), { 0.353558f, -0.306192f, -0.306181f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.117183f }, { 0.353553f, -0.250000f, -0.250000f, 0.0f } }
}, X51Cfg[5] = {
- { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f), { 0.208954f, 0.212846f, 0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, 0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, 0.047490f } },
- { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.208950f, 0.212842f, -0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017740f, -0.204011f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051022f, -0.047489f } },
- { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f } },
- { BackLeft, DEG2RAD(-110.0f), DEG2RAD(0.0f), { 0.470934f, -0.369630f, 0.349383f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031379f, -0.058143f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007116f, -0.043968f } },
- { BackRight, DEG2RAD( 110.0f), DEG2RAD(0.0f), { 0.470936f, -0.369626f, -0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, 0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, 0.043968f } }
+ { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f), { 0.208954f, 0.212846f, 0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, 0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, 0.047490f }, { 0.208954f, 0.162905f, 0.182425f, 0.0f } },
+ { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.208954f, 0.212846f, -0.238350f, 0.0f, 0.0f, 0.0f, 0.0f, -0.017738f, -0.204014f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.051023f, -0.047490f }, { 0.208954f, 0.162905f, -0.182425f, 0.0f } },
+ { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } },
+ { BackLeft, DEG2RAD(-110.0f), DEG2RAD(0.0f), { 0.470936f, -0.369626f, 0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, -0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, -0.043968f }, { 0.470934f, -0.282903f, 0.267406f, 0.0f } },
+ { BackRight, DEG2RAD( 110.0f), DEG2RAD(0.0f), { 0.470936f, -0.369626f, -0.349386f, 0.0f, 0.0f, 0.0f, 0.0f, -0.031375f, 0.058144f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.007119f, 0.043968f }, { 0.470934f, -0.282903f, -0.267406f, 0.0f } }
}, X51SideCfg[5] = {
- { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } },
- { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f } },
- { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f } },
- { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f } },
- { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.289157f, -0.081298f, -0.401295f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071419f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f } }
+ { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f }, { 0.167065f, 0.153519f, 0.132175f, 0.0f } },
+ { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f }, { 0.167065f, 0.153519f, -0.132175f, 0.0f } },
+ { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } },
+ { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f }, { 0.289151f, -0.062225f, 0.307136f, 0.0f } },
+ { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.289157f, -0.081298f, -0.401295f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071419f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f }, { 0.289151f, -0.062225f, -0.307136f, 0.0f } }
}, X61Cfg[6] = {
- { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } },
- { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f } },
- { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f } },
- { BackCenter, DEG2RAD(180.0f), DEG2RAD(0.0f), { 0.353556f, -0.461940f, -0.000006f, 0.0f, 0.0f, 0.0f, 0.0f, 0.165723f, -0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.000005f } },
- { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f } },
- { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.289157f, -0.081298f, -0.401295f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071419f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f } }
+ { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f }, { 0.167065f, 0.153519f, 0.132175f, 0.0f } },
+ { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f }, { 0.167065f, 0.153519f, -0.132175f, 0.0f } },
+ { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } },
+ { BackCenter, DEG2RAD(180.0f), DEG2RAD(0.0f), { 0.353556f, -0.461940f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.165723f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.000005f }, { 0.353556f, -0.353554f, 0.000000f, 0.0f } },
+ { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f), { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f }, { 0.289151f, -0.062225f, 0.307136f, 0.0f } },
+ { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.289157f, -0.081298f, -0.401295f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071419f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f }, { 0.289151f, -0.062225f, -0.307136f, 0.0f } }
}, X71Cfg[7] = {
- { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } },
- { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f } },
- { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f } },
- { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f), { 0.224752f, -0.295009f, 0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, -0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, 0.065799f } },
- { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f), { 0.224739f, -0.295005f, -0.170331f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105342f, 0.182470f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, -0.065792f } },
- { SideLeft, DEG2RAD( -90.0f), DEG2RAD(0.0f), { 0.224739f, 0.000002f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, -0.065795f } },
- { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.224754f, 0.000004f, -0.340647f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, -0.000004f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, 0.065796f } }
+ { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f), { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f }, { 0.167065f, 0.153519f, 0.132175f, 0.0f } },
+ { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f), { 0.167058f, 0.200580f, -0.172701f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029846f, -0.186405f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068904f }, { 0.167065f, 0.153519f, -0.132175f, 0.0f } },
+ { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f), { 0.109403f, 0.179490f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, -0.000001f }, { 0.109403f, 0.137375f, 0.000000f, 0.0f } },
+ { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f), { 0.224752f, -0.295009f, 0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, -0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, 0.065799f }, { 0.224752f, -0.225790f, 0.130361f, 0.0f } },
+ { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f), { 0.224739f, -0.295005f, -0.170331f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105342f, 0.182470f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, -0.065792f }, { 0.224752f, -0.225790f, -0.130361f, 0.0f } },
+ { SideLeft, DEG2RAD( -90.0f), DEG2RAD(0.0f), { 0.224739f, 0.000002f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, -0.065795f }, { 0.224739f, 0.000000f, 0.260717f, 0.0f } },
+ { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f), { 0.224754f, 0.000004f, -0.340647f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, -0.000004f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.000000f, 0.065796f }, { 0.224739f, 0.000000f, -0.260717f, 0.0f } }
};
const ChannelConfig *config;
ALuint i;
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h
index b67c7034..dd046da8 100644
--- a/OpenAL32/Include/alBuffer.h
+++ b/OpenAL32/Include/alBuffer.h
@@ -32,6 +32,8 @@ enum UserFmtChannels {
UserFmtX51 = AL_5POINT1_SOFT, /* (WFX order) */
UserFmtX61 = AL_6POINT1_SOFT, /* (WFX order) */
UserFmtX71 = AL_7POINT1_SOFT, /* (WFX order) */
+ UserFmtBFormat2D = 0x10000000, /* WXY */
+ UserFmtBFormat3D, /* WXYZ */
};
ALuint BytesFromUserFmt(enum UserFmtType type) DECL_CONST;
@@ -56,6 +58,8 @@ enum FmtChannels {
FmtX51 = UserFmtX51,
FmtX61 = UserFmtX61,
FmtX71 = UserFmtX71,
+ FmtBFormat2D = UserFmtBFormat2D,
+ FmtBFormat3D = UserFmtBFormat3D,
};
#define MAX_INPUT_CHANNELS (8)
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index 191c35b7..833b5fa2 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -587,7 +587,8 @@ typedef struct ChannelConfig {
enum Channel ChanName;
ALfloat Angle;
ALfloat Elevation;
- ALfloat Coeff[MAX_AMBI_COEFFS];
+ ALfloat HOACoeff[MAX_AMBI_COEFFS];
+ ALfloat FOACoeff[4];
} ChannelConfig;
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index fb16d143..0bf252f5 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -218,6 +218,14 @@ void ComputeDirectionalGains(const ALCdevice *device, const ALfloat dir[3], ALfl
void ComputeAngleGains(const ALCdevice *device, ALfloat angle, ALfloat elevation, ALfloat ingain, ALfloat gains[MaxChannels]);
/**
+ * ComputeBFormatGains
+ *
+ * Sets channel gains for a given (first-order) B-Format channel. The channel
+ * number must not be greater than 4, and the resulting gains may be negative.
+ */
+void ComputeBFormatGains(const ALCdevice *device, ALuint channum, ALfloat ingain, ALfloat gains[MaxChannels]);
+
+/**
* SetGains
*
* Helper to set the appropriate channels to the specified gain.
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c
index c82b8833..09471fe8 100644
--- a/OpenAL32/alBuffer.c
+++ b/OpenAL32/alBuffer.c
@@ -189,6 +189,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi
case UserFmtX51: newformat = AL_FORMAT_51CHN32; break;
case UserFmtX61: newformat = AL_FORMAT_61CHN32; break;
case UserFmtX71: newformat = AL_FORMAT_71CHN32; break;
+ case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_FLOAT32; break;
+ case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_FLOAT32; break;
}
err = LoadData(albuf, freq, newformat, size/framesize*align,
srcchannels, srctype, data, align, AL_TRUE);
@@ -211,6 +213,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi
case UserFmtX51: newformat = AL_FORMAT_51CHN16; break;
case UserFmtX61: newformat = AL_FORMAT_61CHN16; break;
case UserFmtX71: newformat = AL_FORMAT_71CHN16; break;
+ case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break;
+ case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break;
}
err = LoadData(albuf, freq, newformat, size/framesize*align,
srcchannels, srctype, data, align, AL_TRUE);
@@ -233,6 +237,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi
case UserFmtX51: newformat = AL_FORMAT_51CHN16; break;
case UserFmtX61: newformat = AL_FORMAT_61CHN16; break;
case UserFmtX71: newformat = AL_FORMAT_71CHN16; break;
+ case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break;
+ case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break;
}
err = LoadData(albuf, freq, newformat, size/framesize*align,
srcchannels, srctype, data, align, AL_TRUE);
@@ -255,6 +261,8 @@ AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoi
case UserFmtX51: newformat = AL_FORMAT_51CHN16; break;
case UserFmtX61: newformat = AL_FORMAT_61CHN16; break;
case UserFmtX71: newformat = AL_FORMAT_71CHN16; break;
+ case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break;
+ case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break;
}
err = LoadData(albuf, freq, newformat, size/framesize*align,
srcchannels, srctype, data, align, AL_TRUE);
@@ -1045,6 +1053,8 @@ ALuint ChannelsFromUserFmt(enum UserFmtChannels chans)
case UserFmtX51: return 6;
case UserFmtX61: return 7;
case UserFmtX71: return 8;
+ case UserFmtBFormat2D: return 3;
+ case UserFmtBFormat3D: return 4;
}
return 0;
}
@@ -1101,6 +1111,14 @@ static ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans,
{ AL_FORMAT_71CHN16, UserFmtX71, UserFmtShort },
{ AL_FORMAT_71CHN32, UserFmtX71, UserFmtFloat },
{ AL_FORMAT_71CHN_MULAW, UserFmtX71, UserFmtMulaw },
+
+ { AL_FORMAT_BFORMAT2D_8, UserFmtBFormat2D, UserFmtUByte },
+ { AL_FORMAT_BFORMAT2D_16, UserFmtBFormat2D, UserFmtShort },
+ { AL_FORMAT_BFORMAT2D_FLOAT32, UserFmtBFormat2D, UserFmtFloat },
+
+ { AL_FORMAT_BFORMAT3D_8, UserFmtBFormat3D, UserFmtUByte },
+ { AL_FORMAT_BFORMAT3D_16, UserFmtBFormat3D, UserFmtShort },
+ { AL_FORMAT_BFORMAT3D_FLOAT32, UserFmtBFormat3D, UserFmtFloat },
};
ALuint i;
@@ -1138,6 +1156,8 @@ ALuint ChannelsFromFmt(enum FmtChannels chans)
case FmtX51: return 6;
case FmtX61: return 7;
case FmtX71: return 8;
+ case FmtBFormat2D: return 3;
+ case FmtBFormat3D: return 4;
}
return 0;
}
@@ -1178,6 +1198,14 @@ static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum Fm
{ AL_7POINT1_8_SOFT, FmtX71, FmtByte },
{ AL_7POINT1_16_SOFT, FmtX71, FmtShort },
{ AL_7POINT1_32F_SOFT, FmtX71, FmtFloat },
+
+ { AL_FORMAT_BFORMAT2D_8, FmtBFormat2D, FmtByte },
+ { AL_FORMAT_BFORMAT2D_16, FmtBFormat2D, FmtShort },
+ { AL_FORMAT_BFORMAT2D_FLOAT32, FmtBFormat2D, FmtFloat },
+
+ { AL_FORMAT_BFORMAT3D_8, FmtBFormat3D, FmtByte },
+ { AL_FORMAT_BFORMAT3D_16, FmtBFormat3D, FmtShort },
+ { AL_FORMAT_BFORMAT3D_FLOAT32, FmtBFormat3D, FmtFloat },
};
ALuint i;