int32 offset
int32 startnote
int32 length
int32 velon
int32 veloff
bool32.risingfalling active
bool32.rising redraw
int32 offset
int32 startnote
int32 velon
int32 veloff
int32 blocksize
int32 offset
int32 startnote
int32 length
bool32.tgl active
combo device
combo blocksize
spinner channel
spinner velon
spinner veloff
objref table
int ntrig;
int v;
int i;
int vt;
int trigt;
int prevt[128];
uint8_t velon;
uint8_t veloff;
uint8_t start;
uint8_t length;
uint8_t plength;
uint32_t offset;
{
int i;
for (i = 0; i < 128; i++)
prevt[i] = -666;
}
offset = inlet_offset + param_offset;
velon = attr_velon + inlet_velon;
veloff = attr_veloff + inlet_veloff;
length = inlet_length + param_length;
start = inlet_startnote + param_startnote;
outlet_offset = offset;
outlet_startnote = start;
outlet_velon = velon;
outlet_veloff = veloff;
outlet_blocksize = attr_blocksize;
if (plength != length) {
i = 0;
plength = length;
}
// re-init
if ((inlet_redraw > 0) && !ntrig) {
ntrig = 1;
{
int ii;
for (ii = 0; ii < length; ii++)
prevt[ii] = -666;
}
}
if (!(inlet_redraw > 0))
ntrig = 0;
// display steps
if (inlet_active || param_active) {
{
i += 1;
if (i == length)
i = 0;
vt = attr_table.array[__USAT((offset + (i << attr_blocksize)),
attr_table.LENGTHPOW)]
<< attr_table.GAIN;
if (prevt[i] != vt)
trigt = 0;
prevt[i] = vt;
if (vt && (!trigt)) {
MidiSend3((midi_device_t)attr_device, MIDI_NOTE_ON + (attr_channel - 1),
start + i, velon);
trigt = 1;
}
if ((!vt) && (!trigt)) {
MidiSend3((midi_device_t)attr_device, MIDI_NOTE_ON + (attr_channel - 1),
start + i, veloff);
trigt = 1;
}
}
}