aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-10-31 17:18:45 -0700
committerChris Robinson <[email protected]>2014-10-31 17:18:45 -0700
commitac51c9cce67dcaa968f527e54c48f20d54117c76 (patch)
treee908cf48d51f8e6ce19613c6b016b0c5abc0a22d /Alc/ALu.c
parent1c0596c233525e9a582269faa4ccb017e5938a28 (diff)
Add preliminary AL_EXT_BFORMAT support
Currently missing the AL_ORIENTATION source property. Gain stepping also does not work.
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c33
1 files changed, 32 insertions, 1 deletions
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++)
{