From 64858e3e94eb98179985f602035b42972752082a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 23 Sep 2015 16:02:46 -0700 Subject: Fix B-Format HRTF decoding --- Alc/hrtf.c | 13 ++++++++----- Alc/panning.c | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'Alc') diff --git a/Alc/hrtf.c b/Alc/hrtf.c index e7fe0f68..999b838e 100644 --- a/Alc/hrtf.c +++ b/Alc/hrtf.c @@ -312,7 +312,10 @@ ALuint GetMovingHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat a } -/* Calculates HRTF coefficients for B-Format channels (only up to first-order). */ +/* Calculates HRTF coefficients for B-Format channels (only up to first-order). + * Note that these will decode a B-Format output mix, which uses FuMa ordering + * and scaling, not N3D! + */ void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALuint num_chans, ALfloat (**coeffs_list)[2], ALuint **delay_list) { ALuint elev_idx, azi_idx; @@ -366,10 +369,10 @@ void GetBFormatHrtfCoeffs(const struct Hrtf *Hrtf, const ALuint num_chans, ALflo y = sinf(-az) * cosf(elev); z = sinf(elev); - ambi_coeffs[0] = 1.0f; - ambi_coeffs[1] = 0.5774f * y; - ambi_coeffs[2] = 0.5774f * z; - ambi_coeffs[3] = 0.5774f * x; + ambi_coeffs[0] = 1.4142f; + ambi_coeffs[1] = x; + ambi_coeffs[2] = y; + ambi_coeffs[3] = z; for(c = 0;c < num_chans;c++) { diff --git a/Alc/panning.c b/Alc/panning.c index 98b44a1b..e6c7bdc0 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -496,7 +496,7 @@ ALvoid aluInitPanning(ALCdevice *device) for(i = 0;i < 4;++i) { - static const enum Channel inputs[4] = { BFormatW, BFormatY, BFormatZ, BFormatX }; + static const enum Channel inputs[4] = { BFormatW, BFormatX, BFormatY, BFormatZ }; int chan = GetChannelIdxByName(device, inputs[i]); coeffs_list[i] = device->Hrtf_Params[chan].Coeffs; delay_list[i] = device->Hrtf_Params[chan].Delay; -- cgit v1.2.3