bool32.rising clear
frac32.positive velocity of active key
bool32.pulse pulse on note-on
bool32.pulse noteOff
int32 note number of active key
int32 number of notes currently held down
bool32 key pressed or released ?
bool32 any notes on hold?
spinner startNote
spinner endNote
spinner noteshift
int8_t _note;
uint8_t _gate;
uint8_t _velo;
uint8_t _rvelo;
uint8_t _touch;
uint8_t count;
bool trig;
bool trigoff;
bool rtrig;
static const uint32_t LENGTHPOW = 7;
static const uint32_t LENGTH = 1 << 7;
static const uint32_t LENGTHMASK = (1 << 7) - 1;
static const uint32_t BITS = 8;
static const uint32_t GAIN = 20;
int8_t array[LENGTH];
_gate = 0;
_note = 0;
_touch = 0;
outlet_currentNote = _note;
outlet_currentGate = _gate << 27;
outlet_currentVelo = _velo << 20;
outlet_noteOn = trig;
outlet_noteOff = trigoff;
trig = 0;
trigoff = 0;
outlet_notecount = count;
outlet_hold = bool(count);
if (inlet_clear && !rtrig) {
{
int i;
for (i = 0; i < LENGTH; i++)
array[i] = 0;
}
rtrig = 1;
count = 0;
}
if (!inlet_clear)
rtrig = 0;
if ((status == MIDI_NOTE_ON + attr_midichannel) && (data2)) {
if (((data1 >= attr_startNote) && (data1 <= attr_endNote)) &&
((data1 + attr_noteshift) > -1)) {
_velo = data2;
_note = (data1 + attr_noteshift);
if (!array[data1 + attr_noteshift])
trig = 1;
array[data1 + attr_noteshift] = _velo;
_gate = 1;
count += 1;
}
}
if (((status == MIDI_NOTE_ON + attr_midichannel) && (!data2)) ||
(status == MIDI_NOTE_OFF + attr_midichannel)) {
if ((data1 >= attr_startNote) && (data1 <= attr_endNote) &&
((data1 + attr_noteshift) > -1)) {
if (array[data1 + attr_noteshift])
trigoff = 1;
array[data1 + attr_noteshift] = 0;
if (count)
count -= 1;
_velo = data2;
_note = (data1 + attr_noteshift);
_gate = 0;
}
}
else if ((status == attr_midichannel + MIDI_CONTROL_CHANGE) &&
(data1 == MIDI_C_ALL_NOTES_OFF)) {
_gate = 0;
}