From 859cc703e75c2699531f041ccd3e8169d44bea50 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 10 Mar 2016 22:56:44 -0800 Subject: Use the proper left and right channels for UHJ output --- Alc/ALu.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Alc/ALu.c') diff --git a/Alc/ALu.c b/Alc/ALu.c index eb7afd90..17c91e52 100644 --- a/Alc/ALu.c +++ b/Alc/ALu.c @@ -1473,9 +1473,16 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) { if(device->Uhj_Encoder) { - /* Encode to stereo-compatible 2-channel UHJ output. */ - EncodeUhj2(device->Uhj_Encoder, device->RealOut.Buffer, - device->VirtOut.Buffer, SamplesToDo); + int lidx = GetChannelIdxByName(device->RealOut, FrontLeft); + int ridx = GetChannelIdxByName(device->RealOut, FrontRight); + if(lidx != -1 && ridx != -1) + { + /* Encode to stereo-compatible 2-channel UHJ output. */ + EncodeUhj2(device->Uhj_Encoder, + device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx], + device->VirtOut.Buffer, SamplesToDo + ); + } } if(device->Bs2b) { -- cgit v1.2.3