int32 offset
int32 start
int32 length
bool32.risingfalling active
bool32.pulse pulse if an element is changed
int32 pad index if inside range
int32 pad index if a pad is held down
int32 offset
int32 start
int32 length
bool32.tgl active
combo blocksize
spinner hold
objref step
objref mod
int8_t _note1;
bool _gate1;
uint8_t matrix;
uint8_t hold;
uint8_t prevmatrix;
uint8_t lastmatrix;
uint8_t start;
uint8_t end;
uint8_t bitmask1 = 0b10001110;
int32_t _value;
int32_t _cc;
int rtrig;
int ntrig;
bool op;
bool ttrig;
uint32_t tc;
int32_t tv;
start = inlet_start + param_start;
end = (start + (inlet_length + param_length));
matrix = (_note1 - ((_note1 >> 4) << 3));
if ((matrix >= start) && (matrix < end)) {
outlet_matrix = matrix;
lastmatrix = matrix;
if (inlet_active || param_active) {
if ((_gate1 && !ntrig) || (matrix != prevmatrix)) {
ntrig = 1;
op = attr_step.array[matrix];
tv = attr_mod.array[(matrix << attr_blocksize)];
if (!tv)
attr_mod.array[(matrix << attr_blocksize)] =
(1 << 27) - 1 >> attr_mod.GAIN;
attr_step.array[matrix] = ((!op) << 27) - !op >> attr_step.GAIN;
rtrig = 1;
}
if (!_gate1) {
ntrig = 0;
ttrig = 0;
}
tc += _gate1;
if ((matrix != prevmatrix) || (!_gate1))
tc = 0;
if ((tc > attr_hold) && (!ttrig)) {
attr_step.array[matrix] = (op << 27) - op >> attr_step.GAIN;
attr_mod.array[(matrix << attr_blocksize)] = tv;
ttrig = 1;
hold = matrix;
}
}
} else {
if (!lastmatrix)
lastmatrix = start;
outlet_matrix = lastmatrix;
}
prevmatrix = matrix;
outlet_trig = rtrig;
outlet_hold = hold;
rtrig = 0;
if ((status == MIDI_NOTE_ON + attr_midichannel) && (data2)) {
if ((data1 - 8) & bitmask1) {
_note1 = data1;
_gate1 = 1;
}
} else if (((status == MIDI_NOTE_ON + attr_midichannel) && (!data2)) ||
(status == MIDI_NOTE_OFF + attr_midichannel)) {
if (_note1 == data1) {
_gate1 = 0;
}
} else if ((status == attr_midichannel + MIDI_CONTROL_CHANGE) &&
(data1 == MIDI_C_ALL_NOTES_OFF)) {
_gate1 = 0;
}