From effb9d1e35ab3679daa6314ffecfc4d71dc4cdf7 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 10 Mar 2016 01:04:28 -0800 Subject: Keep track of the real output's channel names --- Alc/ALu.c | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'Alc/ALu.c') diff --git a/Alc/ALu.c b/Alc/ALu.c index 9ca5dd02..8ea74669 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -101,28 +101,6 @@ extern inline void aluMatrixdSet(aluMatrixd *matrix, ALdouble m30, ALdouble m31, ALdouble m32, ALdouble m33); -/* NOTE: HRTF and UHJ are set up a bit special in the device. Normally the - * device's DryBuffer, NumChannels, ChannelName, and Channel fields correspond - * to the output format, and the DryBuffer is then converted and written to the - * backend's audio buffer. - * - * With HRTF or UHJ, these fields correspond to a virtual format, and the - * actual output is stored in DryBuffer[NumChannels] for the left channel and - * DryBuffer[NumChannels+1] for the right. As a final output step, - * the virtual channels will have HRTF filters or UHJ encoding applied and - * written to the actual output. - * - * Sources that get mixed using HRTF directly (or that want to skip HRTF or UHJ - * completely) will need to offset the output buffer so that they skip the - * virtual output and write to the actual output channels. This is the reason - * you'll see - * - * voice->Direct.OutBuffer += voice->Direct.OutChannels; - * voice->Direct.OutChannels = 2; - * - * at various points in the code where HRTF is explicitly used or bypassed. - */ - static inline HrtfMixerFunc SelectHrtfMixer(void) { #ifdef HAVE_SSE @@ -587,11 +565,14 @@ ALvoid CalcNonAttnSourceParams(ALvoice *voice, const ALsource *ALSource, const A { for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) voice->Direct.Gains[c].Target[j] = 0.0f; - - if(chans[c].channel == FrontLeft) - voice->Direct.Gains[c].Target[0] = DryGain; - else if(chans[c].channel == FrontRight) - voice->Direct.Gains[c].Target[1] = DryGain; + for(j = 0;j < Device->RealOut.NumChannels;j++) + { + if(chans[c].channel == Device->RealOut.ChannelName[j]) + { + voice->Direct.Gains[c].Target[j] = DryGain; + break; + } + } } } else for(c = 0;c < num_channels;c++) -- cgit v1.2.3