Browse Source

Fix quad midi pedal handling

tags/v0.5.0
ben 7 years ago
parent
commit
f67d37ec91
1 changed files with 15 additions and 4 deletions
  1. +15
    -4
      src/core/QuadMidiToCV.cpp

+ 15
- 4
src/core/QuadMidiToCV.cpp View File

@@ -164,6 +164,7 @@ void QuadMIDIToCVInterface::processMidi(std::vector<unsigned char> msg) {
if (data1 == 0x40) { // pedal if (data1 == 0x40) { // pedal
pedal = (data2 >= 64); pedal = (data2 >= 64);
if (!pedal) { if (!pedal) {
open.clear();
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
activeKeys[i].gate = false; activeKeys[i].gate = false;
open.push_back(i); open.push_back(i);
@@ -175,7 +176,11 @@ void QuadMIDIToCVInterface::processMidi(std::vector<unsigned char> msg) {
return; return;
} }


if (!pedal && !gate) {
if (pedal && !gate) {
return;
}

if (!gate) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
if (activeKeys[i].pitch == data1) { if (activeKeys[i].pitch == data1) {
activeKeys[i].gate = false; activeKeys[i].gate = false;
@@ -189,13 +194,21 @@ void QuadMIDIToCVInterface::processMidi(std::vector<unsigned char> msg) {
return; return;
} }


if (pedal) {
for (int i = 0; i < 4 ; i++) {
if (activeKeys[i].pitch == data1 && activeKeys[i].gate) {
activeKeys[i].vel = data2;
return;
}
}
}

if (open.empty()) { if (open.empty()) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
open.push_back(i); open.push_back(i);
} }
} }



if (!activeKeys[0].gate && !activeKeys[1].gate && if (!activeKeys[0].gate && !activeKeys[1].gate &&
!activeKeys[2].gate && !activeKeys[3].gate) { !activeKeys[2].gate && !activeKeys[3].gate) {
open.sort(); open.sort();
@@ -215,8 +228,6 @@ void QuadMIDIToCVInterface::processMidi(std::vector<unsigned char> msg) {
break; break;
case ROTATE: case ROTATE:
break; break;
default:
fprintf(stderr, "No mode selected?!\n");
} }


activeKeys[open.front()].gate = true; activeKeys[open.front()].gate = true;


Loading…
Cancel
Save