diff options
author | Chris Robinson <[email protected]> | 2017-01-15 13:57:22 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-01-15 13:57:22 -0800 |
commit | 9f23d17333c8faaa0a2b7a86df33c41874a929a5 (patch) | |
tree | dd68191ae059b295ada025738d3185845596bdc0 /Alc/ALc.c | |
parent | 8e868823fd0226a960259363cd7b49ea51ece426 (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.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -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) |