add individual volume control for teensy

This commit is contained in:
Dooho Yi 2022-05-21 05:51:32 +09:00
parent d1512da5dc
commit 53ad1c9504

View file

@ -244,14 +244,17 @@ void receiveEvent(int numBytes) {
// sample_now = key; // sample_now = key;
// //
int velocity = str_velocity.toInt(); // 0 ~ 127 int velocity = str_velocity.toInt(); // 0 ~ 127
int gate = str_gate.toInt();
//
if (velocity != 0 || gate == 2) {
float amp_gain = (float)velocity / 127.0; float amp_gain = (float)velocity / 127.0;
// //
amp_gain = amp_gain * GAIN_FACTOR; amp_gain = amp_gain * GAIN_FACTOR;
// //
amp1.gain(amp_gain); amp1.gain(amp_gain);
amp2.gain(amp_gain); amp2.gain(amp_gain);
}
// //
int gate = str_gate.toInt();
if (gate == 1) { //on 'start' if (gate == 1) { //on 'start'
// filter out re-triggering same note while it is playing. // filter out re-triggering same note while it is playing.
if (!playSdWav1.isPlaying() || sample_now != key) { if (!playSdWav1.isPlaying() || sample_now != key) {