aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-07-29 21:55:43 -0700
committerChris Robinson <[email protected]>2016-07-29 21:55:43 -0700
commitb5b3ea95f899410a5392fb633ace74c10bbd9921 (patch)
treebc66330db4d484395d1391fb5bd64cb68edeff6d /Alc/panning.c
parent96e83f95eef5be8e1f64a1a2e61810cb7b82ff5c (diff)
Add a config to output first-, second-, or third-order ambisonics
Currently incomplete, as second- and third-order output will not correctly handle B-Format input buffers. A standalone up-sampler will be needed, similar to the high-quality decoder. Also, output is ACN ordering with SN3D normalization. A config option will eventually be provided to change this if desired.
Diffstat (limited to 'Alc/panning.c')
-rw-r--r--Alc/panning.c42
1 files changed, 41 insertions, 1 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index f81a6fc0..0c1bf06f 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -575,6 +575,9 @@ static void InitPanning(ALCdevice *device)
break;
case DevFmtBFormat3D:
+ case DevFmtAmbi1:
+ case DevFmtAmbi2:
+ case DevFmtAmbi3:
break;
}
@@ -593,6 +596,40 @@ static void InitPanning(ALCdevice *device)
device->FOAOut.Ambi = device->Dry.Ambi;
device->FOAOut.CoeffCount = device->Dry.CoeffCount;
}
+ else if(device->FmtChans == DevFmtAmbi1)
+ {
+ count = 4;
+ for(i = 0;i < count;i++)
+ {
+ device->Dry.Ambi.Map[i].Scale = 1.0f/SN3D2N3DScale[i];
+ device->Dry.Ambi.Map[i].Index = i;
+ }
+ device->Dry.CoeffCount = 0;
+ device->Dry.NumChannels = count;
+
+ device->FOAOut.Ambi = device->Dry.Ambi;
+ device->FOAOut.CoeffCount = device->Dry.CoeffCount;
+ }
+ else if(device->FmtChans == DevFmtAmbi2 || device->FmtChans == DevFmtAmbi3)
+ {
+ count = (device->FmtChans == DevFmtAmbi3) ? 16 :
+ (device->FmtChans == DevFmtAmbi2) ? 9 : 1;
+ for(i = 0;i < count;i++)
+ {
+ device->Dry.Ambi.Map[i].Scale = 1.0f/SN3D2N3DScale[i];
+ device->Dry.Ambi.Map[i].Index = i;
+ }
+ device->Dry.CoeffCount = 0;
+ device->Dry.NumChannels = count;
+
+ memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi));
+ for(i = 0;i < 4;i++)
+ {
+ device->FOAOut.Ambi.Map[i].Scale = 1.0f;
+ device->FOAOut.Ambi.Map[i].Index = i;
+ }
+ device->FOAOut.CoeffCount = 0;
+ }
else
{
SetChannelMap(device->RealOut.ChannelName, device->Dry.Ambi.Coeffs,
@@ -835,10 +872,13 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
case DevFmtX51Rear: layout = "surround51rear"; break;
case DevFmtX61: layout = "surround61"; break;
case DevFmtX71: layout = "surround71"; break;
- /* Mono, Stereo, and B-Fornat output don't use custom decoders. */
+ /* Mono, Stereo, and Ambisonics output don't use custom decoders. */
case DevFmtMono:
case DevFmtStereo:
case DevFmtBFormat3D:
+ case DevFmtAmbi1:
+ case DevFmtAmbi2:
+ case DevFmtAmbi3:
break;
}
if(layout)