aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-07-30 09:29:21 -0700
committerChris Robinson <[email protected]>2016-07-30 09:29:21 -0700
commit33a84f17ac78ac1f77b48fbd1193fafab5ca14e7 (patch)
tree66055c0a89d22552b856038434333b2ca2eb06cc /Alc/panning.c
parentb5b3ea95f899410a5392fb633ace74c10bbd9921 (diff)
Add a stand-alone upsampler for higher-order ambisonic oputput
Diffstat (limited to 'Alc/panning.c')
-rw-r--r--Alc/panning.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/Alc/panning.c b/Alc/panning.c
index 0c1bf06f..80909564 100644
--- a/Alc/panning.c
+++ b/Alc/panning.c
@@ -622,6 +622,9 @@ static void InitPanning(ALCdevice *device)
device->Dry.CoeffCount = 0;
device->Dry.NumChannels = count;
+ /* FOA output is always ACN+N3D for higher-order ambisonic output. The
+ * upsampler expects this and will convert it for output.
+ */
memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi));
for(i = 0;i < 4;i++)
{
@@ -629,6 +632,8 @@ static void InitPanning(ALCdevice *device)
device->FOAOut.Ambi.Map[i].Index = i;
}
device->FOAOut.CoeffCount = 0;
+
+ ambiup_reset(device->AmbiUp, device);
}
else
{
@@ -903,6 +908,8 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
if(pconf && GetConfigValueBool(devname, "decoder", "hq-mode", 0))
{
+ ambiup_free(device->AmbiUp);
+ device->AmbiUp = NULL;
if(!device->AmbiDecoder)
device->AmbiDecoder = bformatdec_alloc();
}
@@ -910,6 +917,16 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
{
bformatdec_free(device->AmbiDecoder);
device->AmbiDecoder = NULL;
+ if(device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3)
+ {
+ if(!device->AmbiUp)
+ device->AmbiUp = ambiup_alloc();
+ }
+ else
+ {
+ ambiup_free(device->AmbiUp);
+ device->AmbiUp = NULL;
+ }
}
if(!pconf)
@@ -923,6 +940,8 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf
return;
}
+ ambiup_free(device->AmbiUp);
+ device->AmbiUp = NULL;
bformatdec_free(device->AmbiDecoder);
device->AmbiDecoder = NULL;