From ad7ad48bd126191e4936d386e55945832b9574d5 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sat, 26 Mar 2016 20:23:20 -0700 Subject: [PATCH] Don't use custom decoder configurations with mono or stereo By default, stereo outputs using UHJ, which renders to a B-Format buffer that gets run through a UHJ encoder for output. It may also output using pair-wise panning, which pans between -30 and +30 degrees with the speakers at the two ends. In both cases, the stereo coefficients are ignored. Mono, having only one output channel, can realistically only attenuate its channel. Turning the volume up and down accomplishes the same result. --- Alc/panning.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Alc/panning.c b/Alc/panning.c index 90122550..c3145cd7 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -390,6 +390,13 @@ static bool LoadChannelSetup(ALCdevice *device) AmbDecConf conf; ALuint i, j; + /* Don't use custom decoders with mono or stereo output (stereo is using + * UHJ or pair-wise panning, thus ignores the custom coefficients anyway, + * and mono would realistically only specify attenuation on the output). + */ + if(device->FmtChans == DevFmtMono || device->FmtChans == DevFmtStereo) + return false; + layout = GetChannelLayoutName(device->FmtChans); if(!layout) return false; @@ -629,6 +636,12 @@ ALvoid aluInitPanning(ALCdevice *device) ambdec_init(&conf); + /* Don't do HQ ambisonic decoding with mono or stereo output. Same + * reasons as in LoadChannelSetup. + */ + if(device->FmtChans == DevFmtMono || device->FmtChans == DevFmtStereo) + goto ambi_fail; + layout = GetChannelLayoutName(device->FmtChans); if(!layout) goto ambi_fail;