Browse Source

fix pedal gate release

tags/v0.6.0
ben 6 years ago
parent
commit
a99bca7daa
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      src/core/QuadMidiToCV.cpp

+ 10
- 7
src/core/QuadMidiToCV.cpp View File

@@ -161,14 +161,15 @@ 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++) {
if (activeKeys[i].pedal_gate_released) { if (activeKeys[i].pedal_gate_released) {
activeKeys[i].pedal_gate_released = false;
continue;
activeKeys[i].gate = false;
activeKeys[i].pedal_gate_released = false;
if (std::find(open.begin(), open.end(), i) != open.end()) {
open.remove(i);
}
open.push_front(i);
} }
activeKeys[i].gate = false;
open.push_back(i);
} }
} }
} }
@@ -179,11 +180,11 @@ void QuadMIDIToCVInterface::processMidi(std::vector<unsigned char> msg) {


if (pedal && !gate) { if (pedal && !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) {
activeKeys[i].pedal_gate_released = true; activeKeys[i].pedal_gate_released = true;
return;
} }
} }
return;
} }


if (!gate) { if (!gate) {
@@ -240,10 +241,12 @@ void QuadMIDIToCVInterface::processMidi(std::vector<unsigned char> msg) {


open.push_front(i); open.push_front(i);
activeKeys[i].gate = false; activeKeys[i].gate = false;
activeKeys[i].pedal_gate_released = false;
} }
} }


activeKeys[next].gate = true; activeKeys[next].gate = true;
activeKeys[next].pedal_gate_released = false;
activeKeys[next].pitch = data1; activeKeys[next].pitch = data1;
activeKeys[next].vel = data2; activeKeys[next].vel = data2;
} }


Loading…
Cancel
Save