Skip to content

Commit

Permalink
Swap left/right audio channels.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Mar 12, 2024
1 parent 2ad6057 commit 683155e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/i2s_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ void i2s_audio_give_buffer(void *src, size_t len, uint8_t bit_depth, uint8_t vol
if(in_samples < samples) samples = in_samples;

for (uint i = 0u; i < samples * 2; i+=2) {
out[i+0] = ((uint32_t)in[i+0] * volume) / 256;
out[i+1] = ((uint32_t)in[i+1] * volume) / 256;
out[i+0] = ((uint32_t)in[i+1] * volume) / 256;
out[i+1] = ((uint32_t)in[i+0] * volume) / 256;
}

audio_buffer->sample_count = samples;
Expand All @@ -103,8 +103,8 @@ void i2s_audio_give_buffer(void *src, size_t len, uint8_t bit_depth, uint8_t vol
if(in_samples < samples) samples = in_samples;

for (uint i = 0u; i < samples * 2; i+=2) {
out[i+0] = ((in[i+0] / 65536) * volume) / 256;
out[i+1] = ((in[i+1] / 65536) * volume) / 256;
out[i+0] = ((in[i+1] / 65536) * volume) / 256;
out[i+1] = ((in[i+0] / 65536) * volume) / 256;
}

audio_buffer->sample_count = samples;
Expand Down

0 comments on commit 683155e

Please sign in to comment.