aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/panning.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-03-26 20:23:20 -0700
committerChris Robinson <[email protected]>2016-03-26 20:23:20 -0700
commitad7ad48bd126191e4936d386e55945832b9574d5 (patch)
tree0de25015c46351297e352737da2ebafc8e9aabbe /Alc/panning.c
parentb4a1ba9d3f7a87568059192dab4136a64ff13eb3 (diff)
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.
Diffstat (limited to 'Alc/panning.c')
-rw-r--r--Alc/panning.c13
1 files changed, 13 insertions, 0 deletions
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;