int32.positive offset in the table to read from
int32.positive number of elements of the table to display as rows
int32.positive starting at row...
int32.positive color modulation
bool32.risingfalling active
bool32.rising redraw
bool32.pulse pulse if sliders are changed
bool32.tgl active
int32 offset
int32 rows
int32 startrow
objref table
combo device
combo color
int8_t _note1;
int8_t prenote;
uint8_t _gate1;
int8_t pos;
int8_t prepos;
int32_t i;
int32_t v;
uint8_t vt;
int32_t prev[8];
uint32_t offset;
uint8_t onC;
uint8_t row;
uint8_t rows;
uint8_t prerow;
int32_t crow;
int ntrig;
int rtrig;
bool range;
{
int i;
for (i = 0; i < 8; i++)
prev[i] = -666;
}
rtrig = 0;
offset = (param_offset + inlet_offset);
row = (param_startrow + inlet_startrow);
onC = (attr_color + inlet_color);
rows = (inlet_rows + param_rows);
if (inlet_active || param_active) {
// redraw
if ((inlet_redraw > 0) && !ntrig) {
ntrig = 1;
{
int i;
for (i = 0; i < rows; i++)
prev[i] = -666;
}
}
if (!(inlet_redraw > 0))
ntrig = 0;
{
if ((crow == rows) || (rows != prerow)) {
crow = 0;
prerow = rows;
}
pos = (_note1 - ((row + crow) << 4));
if (((pos >= 1) && (pos <= 9)) && ((pos != prepos) || _gate1)) {
prepos = pos;
if (pos != 9)
attr_table.array[offset + crow] =
__SSAT((pos << 24), 28) >> attr_table.GAIN;
else
attr_table.array[offset + crow] = 0;
range = 1;
} else
range = 0;
v = ((attr_table.array[__USAT((offset + crow), attr_table.LENGTHPOW)]
<< attr_table.GAIN) >>
23);
// changed??
if ((v != prev[crow]) && (range))
rtrig = 1;
if (v != prev[crow]) {
i = 0;
prev[crow] = v;
MidiSend3((midi_device_t)attr_device, MIDI_NOTE_ON,
(((row + crow) << 4) + 8), onC);
}
if (i < 8) {
vt = (v > (i << 1)) ? (onC) : 0;
MidiSend3((midi_device_t)attr_device, MIDI_NOTE_ON,
(((row + crow) << 4) + i), vt);
i += 1;
} else
crow += 1;
}
outlet_trig = rtrig;
rtrig = 0;
}
if ((status == MIDI_NOTE_ON + attr_midichannel) && (data2)) {
_note1 = data1 + 1;
_gate1 = 1;
} else if (((status == MIDI_NOTE_ON + attr_midichannel) && (!data2)) ||
(status == MIDI_NOTE_OFF + attr_midichannel)) {
if (_note1 == (data1 + 1)) {
_gate1 = 0;
}
} else if ((status == attr_midichannel + MIDI_CONTROL_CHANGE) &&
(data1 == MIDI_C_ALL_NOTES_OFF)) {
_gate1 = 0;
}