Skip to content

Commit

Permalink
codal_app: Make sure volume can achieve the full CODAL range.
Browse files Browse the repository at this point in the history
The CODAL setVolume() method takes a value in the range 0-255.

Fixes issue #159.

Signed-off-by: Damien George <[email protected]>
  • Loading branch information
dpgeorge committed Nov 13, 2023
1 parent 957e810 commit a37bc96
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/codal_app/microbithal_audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,7 @@ void microbit_hal_audio_select_speaker(bool enable) {

// Input value has range 0-255 inclusive.
void microbit_hal_audio_set_volume(int value) {
if (value >= 255) {
uBit.audio.setVolume(128);
} else {
uBit.audio.setVolume(value / 2);
}
uBit.audio.setVolume(value);
}

void microbit_hal_sound_synth_callback(int event) {
Expand Down

0 comments on commit a37bc96

Please sign in to comment.