fixed octave shift buttons

This commit is contained in:
2020-04-12 19:19:11 +02:00
parent deb5a77124
commit 5d89af0220
3 changed files with 37 additions and 31 deletions
+3
View File
@@ -64,3 +64,6 @@ dkms.conf
.vscode/ipch
.vscode
*.code-workspace
# Libreoffice
.~lock.*
Binary file not shown.
+7 -4
View File
@@ -70,6 +70,7 @@ byte matrix[16][6][2] = {
/*6*/ {{1, 30}, {1, 31}, {1, 32}, {1, 33}, {1, 34}, {1, 35}},
/*7*/ {{1, 24}, {1, 25}, {1, 26}, {1, 27}, {1, 28}, {1, 29}},
/*8*/ {{1, 12}, {1, 13}, {1, 14}, {1, 15}, {1, 16}, {1, 17}},
/*9*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},
/*a*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},
/*b*/ {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},
/*c*/ {{2, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}},
@@ -80,7 +81,7 @@ byte matrix[16][6][2] = {
bool ref[16][6] = {{false}};
unsigned char shift = 0;
unsigned char shift = 12;
void setup() {
for (size_t i = 0; i < KEYBOARD_INSIZE; ++i) {
@@ -128,13 +129,16 @@ void button_matrix_mgt(void) {
#ifndef DEBUG_MATRIX
byte type = matrix[i][j][0];
byte key = matrix[i][j][1];
#ifdef __PLATFORMIO_BUILD_DEBUG__
midi.sendNoteOn({type, CHANNEL_3}, key);
#endif /* __PLATFORMIO_BUILD_DEBUG__ */
if (type == 1) {
midi.sendNoteOn({key + shift, channel}, NOTE_VELOCITY);
} else if (type == 2) {
// todo : note off
if (key == 0 && shift >= 12) {
shift -= 12;
} else if (key == 1 && shift <= 0xFF - 47 - 12) {
} else if (key == 1 && shift <= 6 * 12) {
shift += 12;
}
}
@@ -164,8 +168,7 @@ void capa_sensor_mgt(void) {
int static lasttouched;
int currtouched = capa_sensor.touched();
for (uint8_t i = 0; i < 12; i++)
{
for (uint8_t i = 0; i < 12; i++) {
// it if *is* touched and *wasnt* touched before, alert!
if ((currtouched & _BV(i)) && !(lasttouched & _BV(i))) {
midi.sendCC({i, channel}, ON);