int32 offset
int32 startnote
int32 length
bool32.risingfalling active
bool32.rising redraw
int32 offset
int32 startnote
int32 blocksize
bool32.tgl active
int32 offset
int32 startnote
int32 length
objref table
combo device
combo blocksize
spinner channel
int ntrig;
int v;
int i;
int vt;
int trigt;
int prevt[128];
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;
length = inlet_length + param_length;
start = inlet_startnote + param_startnote;
outlet_offset = offset;
outlet_startnote = start;
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) {
MidiSend3((midi_device_t)attr_device, MIDI_NOTE_ON + (attr_channel - 1),
start + i, (vt >> 20));
prevt[i] = vt;
}
}
}