aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-01-15 13:57:22 -0800
committerChris Robinson <[email protected]>2017-01-15 13:57:22 -0800
commit9f23d17333c8faaa0a2b7a86df33c41874a929a5 (patch)
treedd68191ae059b295ada025738d3185845596bdc0 /Alc/ALc.c
parent8e868823fd0226a960259363cd7b49ea51ece426 (diff)
Use second-order ambisonics for basic HRTF rendering
This should improve positional quality for relatively low cost. Full HRTF rendering still only uses first-order since the only use of the dry buffer there is for first-order content (B-Format buffers, effects).
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index c9507564..0b558ff7 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -2055,9 +2055,13 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
if((device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2))
size += (ChannelsFromDevFmt(device->FmtChans)+4) * sizeof(device->Dry.Buffer[0]);
else if(device->Hrtf.Handle || device->Uhj_Encoder || device->AmbiDecoder)
+ {
size += ChannelsFromDevFmt(device->FmtChans) * sizeof(device->Dry.Buffer[0]);
- else if(device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3)
+ if(device->AmbiUp) size += 4 * sizeof(device->Dry.Buffer[0]);
+ }
+ else if(device->AmbiUp)
size += 4 * sizeof(device->Dry.Buffer[0]);
+ TRACE("Allocating "SZFMT" channels, "SZFMT" bytes\n", size/sizeof(device->Dry.Buffer[0]), size);
device->Dry.Buffer = al_calloc(16, size);
if(!device->Dry.Buffer)
{
@@ -2076,8 +2080,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->RealOut.NumChannels = device->Dry.NumChannels;
}
- if((device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2) ||
- (device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3))
+ if((device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2) || device->AmbiUp)
{
/* Higher-order rendering requires upsampling first-order content, so
* make sure to mix it separately.
@@ -2090,6 +2093,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->FOAOut.Buffer = device->Dry.Buffer;
device->FOAOut.NumChannels = device->Dry.NumChannels;
}
+ TRACE("Channel config, Dry: %u, FOA: %u, Real: %u\n", device->Dry.NumChannels,
+ device->FOAOut.NumChannels, device->RealOut.NumChannels);
SetMixerFPUMode(&oldMode);
if(device->DefaultSlot)