From cdf71d6bcfba1ad78a487f0b116b39d977ee24c4 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sat, 15 Aug 2020 21:05:12 -0700 Subject: [PATCH] Fix AAC mono decode (#297) As noted by Marc Madaule (thanks!), the mono AAC decode was not functioning properly. Adjust the output stuff loop to fix. --- src/AudioGeneratorAAC.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/AudioGeneratorAAC.cpp b/src/AudioGeneratorAAC.cpp index 98f7207..c756867 100644 --- a/src/AudioGeneratorAAC.cpp +++ b/src/AudioGeneratorAAC.cpp @@ -144,8 +144,13 @@ bool AudioGeneratorAAC::loop() // If we've got data, try and pump it out... while (validSamples) { - lastSample[0] = outSample[curSample*2]; - lastSample[1] = outSample[curSample*2 + 1]; + if (lastChannels == 1) { + lastSample[0] = outSample[curSample]; + lastSample[1] = outSample[curSample]; + } else { + lastSample[0] = outSample[curSample*2]; + lastSample[1] = outSample[curSample*2 + 1]; + } if (!output->ConsumeSample(lastSample)) goto done; // Can't send, but no error detected validSamples--; curSample++;