Skip to content

Commit

Permalink
single channel to L/R channel
Browse files Browse the repository at this point in the history
  • Loading branch information
SciLor committed May 7, 2022
1 parent 40dd277 commit 071db4a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion AudioOutputCC3200I2S.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,12 @@ bool AudioOutputCC3200I2S::ConsumeSample(int16_t sample[2])
ms[1] = sample[1];
MakeSampleStereo16( ms );

if (this->mono) {
if (this->mono && this->channels == 2) {
// Average the two samples and overwrite
int32_t ttl = ms[LEFTCHANNEL] + ms[RIGHTCHANNEL];
ms[LEFTCHANNEL] = ms[RIGHTCHANNEL] = (ttl>>1) & 0xffff;
} else if (this->channels == 1) {
ms[LEFTCHANNEL] = ms[RIGHTCHANNEL];
}

writeBuffer->buffer[writeBuffer->position++] = ms[LEFTCHANNEL];
Expand Down

0 comments on commit 071db4a

Please sign in to comment.