None
frac32.positive note-on velocity
frac32.positive note-off velocity
frac32.bipolar midi note number
bool32 key pressed - holds on legato notes
bool32 key pressed - retriggers on legato notes
spinner startNote
spinner endNote
int8_t _note;
int32_t _gate;
int32_t _gate2;
uint8_t _velo;
uint8_t _rvelo;
uint32_t np[attr_endNote - attr_startNote + 1];
uint32_t p;
_gate = 0;
_gate2 = 0;
_note = 0;
p = 1;
int j;
for (j = 0; j < attr_endNote - attr_startNote + 1; j++)
np[j] = 0;
outlet_note = _note << 21;
outlet_gate = _gate;
outlet_gate2 = _gate2;
_gate2 = _gate;
outlet_velocity = _velo << 20;
outlet_releaseVelocity = _rvelo << 20;
if ((status == MIDI_NOTE_ON + attr_midichannel) && (data2)) {
if ((data1 >= attr_startNote) && (data1 <= attr_endNote)) {
_velo = data2;
_note = data1 - 64;
_gate = 1 << 27;
_gate2 = 0;
np[data1 - attr_startNote] = p++;
}
} else if (((status == MIDI_NOTE_ON + attr_midichannel) && (!data2)) ||
(status == MIDI_NOTE_OFF + attr_midichannel)) {
if ((data1 >= attr_startNote) && (data1 <= attr_endNote)) {
_rvelo = data2;
np[data1 - attr_startNote] = 0;
int j;
int np2 = 0;
int n2 = -1;
for (j = 0; j < attr_endNote - attr_startNote + 1; j++) {
if (np[j] > np2) {
np2 = np[j];
n2 = j;
}
}
if (n2 >= 0) {
int nn = n2 + attr_startNote - 64;
if (nn != _note) {
_gate2 = 0;
_note = nn;
}
} else
_gate = 0;
}
} else if ((status == attr_midichannel + MIDI_CONTROL_CHANGE) &&
(data1 == MIDI_C_ALL_NOTES_OFF)) {
_gate = 0;
}