mirror of
https://git.alemi.dev/cv-keyboard.git
synced 2024-11-24 01:14:48 +01:00
Added off counter but with value 0
This commit is contained in:
parent
54fc6f26ab
commit
3e477f4ca8
1 changed files with 13 additions and 6 deletions
|
@ -18,7 +18,7 @@
|
||||||
#define Oct4 10
|
#define Oct4 10
|
||||||
|
|
||||||
#define noteOffset 36
|
#define noteOffset 36
|
||||||
#define offCounter 100
|
#define offCounter 0
|
||||||
|
|
||||||
#include <MIDI.h>
|
#include <MIDI.h>
|
||||||
#include <HID.h>
|
#include <HID.h>
|
||||||
|
@ -60,12 +60,18 @@ void send() {
|
||||||
for (int c = 48; c >= 0; c--) {
|
for (int c = 48; c >= 0; c--) {
|
||||||
if (flip[c] == HIGH) {
|
if (flip[c] == HIGH) {
|
||||||
flip[c] = LOW;
|
flip[c] = LOW;
|
||||||
noteBuffer = c + noteOffset;
|
if (noteCounter[c] > 0) {
|
||||||
if (status[c] == HIGH) {
|
noteCounter[c]--;
|
||||||
MIDI.sendNoteOn(noteBuffer, velocity, 1);
|
|
||||||
}
|
}
|
||||||
else if (status[c] == LOW) {
|
else {
|
||||||
MIDI.sendNoteOff(noteBuffer, velocity, 1);
|
noteCounter[c] = offCounter;
|
||||||
|
noteBuffer = c + noteOffset;
|
||||||
|
if (status[c] == HIGH) {
|
||||||
|
MIDI.sendNoteOn(noteBuffer, velocity, 1);
|
||||||
|
}
|
||||||
|
else if (status[c] == LOW) {
|
||||||
|
MIDI.sendNoteOff(noteBuffer, velocity, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,6 +79,7 @@ void send() {
|
||||||
|
|
||||||
void scan() {
|
void scan() {
|
||||||
for (int cOctave = 0; cOctave < 4; cOctave++) {
|
for (int cOctave = 0; cOctave < 4; cOctave++) {
|
||||||
|
octBuffer = 12 * cOctave;
|
||||||
digitalWrite(octave[cOctave], HIGH);
|
digitalWrite(octave[cOctave], HIGH);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue