From be3679162b69beb0c602f5da28b89ea780048ba5 Mon Sep 17 00:00:00 2001 From: Dooho Yi Date: Wed, 22 Sep 2021 18:58:19 +0900 Subject: [PATCH] added volume control for audioooo --- audioooo/src/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/audioooo/src/main.cpp b/audioooo/src/main.cpp index 0a7c762..73ad125 100644 --- a/audioooo/src/main.cpp +++ b/audioooo/src/main.cpp @@ -45,6 +45,10 @@ #define REPLICATE_NOTE_REQ #define USE_ALTERNATIVE_ADDRESSES +//======================== +#define GAIN_MAX 1.0 // if 1.0 is too loud, give max. limit here. +//======================== + //======================== // #define LED_PERIOD (11111) @@ -348,6 +352,8 @@ void onNoteHandler(Note & n) { screen_cmd = n.to_string(); screen_cmd_notify_task.restart(); // + audio.setVolume(n.velocity * 21 / 127 * GAIN_MAX); // 0...127 ==> 0...21 + // if (n.onoff == 1) { // filter out re-triggering same note while it is playing. if (!audio.isRunning() || sample_now != n.pitch) {