Skip to content

Commit

Permalink
nRF52: Fix volume control in example
Browse files Browse the repository at this point in the history
  • Loading branch information
TMRh20 committed Oct 21, 2024
1 parent 08178aa commit 1717717
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ void loadBuffer() {
} else {
myFile.read(aaAudio.dacBuffer16, BUFFER_SIZE); // Change this to dacBuffer16 for 16-bit samples
for (uint32_t i = 0; i < BUFFER_SIZE / 2; i++) {
aaAudio.dacBuffer16[i] += 0x8000;
aaAudio.dacBuffer16[i] *= volumeControl;
aaAudio.dacBuffer16[i] -= 0x8000;
int16_t sample = aaAudio.dacBuffer16[i];
sample *= volumeControl;
aaAudio.dacBuffer16[i] = (uint16_t)sample;
}
aaAudio.feedDAC(0, BUFFER_SIZE / 2); // change this to 3200 for 16-bit samples
}
Expand Down

0 comments on commit 1717717

Please sign in to comment.