diff options
author | Chris Robinson <[email protected]> | 2015-02-09 15:59:29 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2015-02-09 15:59:29 -0800 |
commit | a1d4847d078f4f807f5697f299eea834797f4287 (patch) | |
tree | 376b457d1655bd0db7747913cdf77be262a831f5 /Alc/panning.c | |
parent | 8933e21ef21c2084570eb9cb998a47053b686ed1 (diff) |
Use B-Format for HRTF's virtual output format
This adds the ability to directly decode B-Format with HRTF, though only first-
order (WXYZ) for now. Second- and third-order would be easilly doable, however
we'd need to be able to up-mix first-order content (from the BFORMAT2D and
BFORMAT3D buffer formats) since it would be inappropriate to decode lower-order
content with a higher-order decoder.
Diffstat (limited to 'Alc/panning.c')
-rw-r--r-- | Alc/panning.c | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/Alc/panning.c b/Alc/panning.c index 4a3541c2..b7b8a0c7 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -339,15 +339,6 @@ ALvoid aluInitPanning(ALCdevice *device) { BackRight, { { 0.224752f, -0.295009f, -0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, 0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065799f }, { 0.224752f, -0.225790f, -0.130361f, 0.0f } } }, { SideLeft, { { 0.224739f, 0.000002f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065795f }, { 0.224739f, 0.000000f, 0.260717f, 0.0f } } }, { SideRight, { { 0.224739f, 0.000002f, -0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065795f }, { 0.224739f, 0.000000f, -0.260717f, 0.0f } } }, - }, Cube8[8] = { - { TopFrontLeft, { { 0.176777f, 0.125000f, 0.125000f, 0.125000f }, { 0.176777f, 0.125000f, 0.125000f, 0.125000f } } }, - { TopFrontRight, { { 0.176777f, 0.125000f, -0.125000f, 0.125000f }, { 0.176777f, 0.125000f, -0.125000f, 0.125000f } } }, - { TopBackLeft, { { 0.176777f, -0.125000f, 0.125000f, 0.125000f }, { 0.176777f, -0.125000f, 0.125000f, 0.125000f } } }, - { TopBackRight, { { 0.176777f, -0.125000f, -0.125000f, 0.125000f }, { 0.176777f, -0.125000f, -0.125000f, 0.125000f } } }, - { BottomFrontLeft, { { 0.176777f, 0.125000f, 0.125000f, -0.125000f }, { 0.176777f, 0.125000f, 0.125000f, -0.125000f } } }, - { BottomFrontRight, { { 0.176777f, 0.125000f, -0.125000f, -0.125000f }, { 0.176777f, 0.125000f, -0.125000f, -0.125000f } } }, - { BottomBackLeft, { { 0.176777f, -0.125000f, 0.125000f, -0.125000f }, { 0.176777f, -0.125000f, 0.125000f, -0.125000f } } }, - { BottomBackRight, { { 0.176777f, -0.125000f, -0.125000f, -0.125000f }, { 0.176777f, -0.125000f, -0.125000f, -0.125000f } } }, }, BFormat3D[4] = { { Aux0, { { 1.0f, 0.0f, 0.0f, 0.0f }, { 1.0f, 0.0f, 0.0f, 0.0f } } }, { Aux1, { { 0.0f, 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f } } }, @@ -362,33 +353,23 @@ ALvoid aluInitPanning(ALCdevice *device) if(device->Hrtf) { - static const struct { - enum Channel channel; - ALfloat elevation; - ALfloat angle; - } VirtualChans[8] = { - { TopFrontLeft, DEG2RAD( 45.0f), DEG2RAD( -45.0f) }, - { TopFrontRight, DEG2RAD( 45.0f), DEG2RAD( 45.0f) }, - { TopBackLeft, DEG2RAD( 45.0f), DEG2RAD(-135.0f) }, - { TopBackRight, DEG2RAD( 45.0f), DEG2RAD( 135.0f) }, - { BottomFrontLeft, DEG2RAD(-45.0f), DEG2RAD( -45.0f) }, - { BottomFrontRight, DEG2RAD(-45.0f), DEG2RAD( 45.0f) }, - { BottomBackLeft, DEG2RAD(-45.0f), DEG2RAD(-135.0f) }, - { BottomBackRight, DEG2RAD(-45.0f), DEG2RAD( 135.0f) }, - }; ALuint i; - count = COUNTOF(Cube8); - chanmap = Cube8; + count = COUNTOF(BFormat3D); + chanmap = BFormat3D; for(i = 0;i < count;i++) - device->ChannelName[i] = VirtualChans[i].channel; + device->ChannelName[i] = chanmap[i].ChanName; + for(;i < MAX_OUTPUT_CHANNELS;i++) + device->ChannelName[i] = InvalidChannel; + SetChannelMap(device, chanmap, count); for(i = 0;i < count;i++) - GetLerpedHrtfCoeffs( - device->Hrtf, VirtualChans[i].elevation, VirtualChans[i].angle, 1.0f, 1.0f, + { + GetBFormatHrtfCoeffs(device->Hrtf, chanmap[i].Config.FOACoeff, device->Hrtf_Params[i].Coeffs, device->Hrtf_Params[i].Delay ); + } return; } |