'note' reacting to 'crtl' bug. fix.

This commit is contained in:
Dooho Yi 2020-10-17 11:53:53 +09:00
parent bd6abfe95c
commit f404c19270

View file

@ -18,7 +18,9 @@
//============<sampler>============ //============<sampler>============
//optionally pin3 will go HIGH/LOW in sync w/ sound PLAY/STOP //optionally pin3 will go HIGH/LOW in sync w/ sound PLAY/STOP
#define MOTOR_PIN 3 #define MOTOR_PIN 3
// #define FAN_ACTION // this is noisy.... // #define FAN_ACTION // this is noisy.... ==> not so recommendable..
#define NOTE_MIN 24
#define NOTE_MAX 84
//============</sampler>=========== //============</sampler>===========
//HACK: let auto-poweroff speakers stay turned ON! - (creative muvo mini) //HACK: let auto-poweroff speakers stay turned ON! - (creative muvo mini)
@ -184,20 +186,22 @@ void receiveEvent(int numBytes) {
// //
int key = str_key.toInt(); int key = str_key.toInt();
sample_now = key; if (key >= NOTE_MIN && key <= NOTE_MAX) {
// sample_now = key;
int velocity = str_velocity.toInt(); // 0 ~ 127 //
float amp_gain = (float)velocity / 127.0; int velocity = str_velocity.toInt(); // 0 ~ 127
amp1.gain(amp_gain); float amp_gain = (float)velocity / 127.0;
amp2.gain(amp_gain); amp1.gain(amp_gain);
// amp2.gain(amp_gain);
int gate = str_gate.toInt(); //
if (gate == 0) { int gate = str_gate.toInt();
sample_player_stop_task.restart(); if (gate == 0) {
Serial.println("sample_player_stop_task"); sample_player_stop_task.restart();
} else { Serial.println("sample_player_stop_task");
sample_player_start_task.restart(); } else {
Serial.println("sample_player_start_task"); sample_player_start_task.restart();
Serial.println("sample_player_start_task");
}
} }
} }
} }