diff options
author | Chris Robinson <[email protected]> | 2016-03-22 17:52:20 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-03-22 17:52:20 -0700 |
commit | 713ac9e6790ac5bb9491a893c9b2ee0a693878b7 (patch) | |
tree | dfba2a437adab49ddea4125e936f5866511e4baa /Alc/ALc.c | |
parent | 0a03596af11570f5dba473c93c67c59d285d7bc2 (diff) |
Add a specific output for first-order sources
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -2133,7 +2133,9 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) /* Allocate extra channels for any post-filter output. */ size = device->Dry.NumChannels * sizeof(device->Dry.Buffer[0]); - if(device->Hrtf || device->Uhj_Encoder || device->AmbiDecoder) + if(device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2) + size += (ChannelsFromDevFmt(device->FmtChans)+4) * sizeof(device->Dry.Buffer[0]); + else if(device->Hrtf || device->Uhj_Encoder || device->AmbiDecoder) size += ChannelsFromDevFmt(device->FmtChans) * sizeof(device->Dry.Buffer[0]); device->Dry.Buffer = al_calloc(16, size); if(!device->Dry.Buffer) @@ -2157,6 +2159,22 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->RealOut.NumChannels = device->Dry.NumChannels; } + if(device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2) + { + /* Higher-order high quality decoding requires upsampling first-order + * content, so make sure to mix it separately. + */ + device->FOAOut.Buffer = device->RealOut.Buffer + device->RealOut.NumChannels; + device->FOAOut.NumChannels = 4; + } + else + { + device->FOAOut.Buffer = device->Dry.Buffer; + device->FOAOut.NumChannels = device->Dry.NumChannels; + memcpy(device->FOAOut.AmbiCoeffs, device->Dry.AmbiCoeffs, + sizeof(device->FOAOut.AmbiCoeffs)); + } + SetMixerFPUMode(&oldMode); V0(device->Backend,lock)(); context = ATOMIC_LOAD(&device->ContextList); |