bool32.rising trigger
frac32.positive velocity
frac32 generate
frac32 offset
None
int32 maxNote
int32 minNote
spinner channel
int ntrig[16];
int lastnote[16];
int32_t velo[16];
int i;
int32_t prev;
int32_t generate;
int32_t random;
for (i = 0; i < 16; i++) {
ntrig[i] = 0;
}
generate = (((inlet_generate >> 13) * 15 / 16) >> 10) + 1;
for (i = 0; i < 16; i++) {
if ((inlet_trig > 0) && (i < (generate))) {
if (ntrig == 0) {
random = ((int32_t)GenerateRandomNumber());
}
velo[i] = (inlet_touch + i * inlet_offset + random) >> 20;
velo[i] = velo[i] & 255;
velo[i] = velo[i] > 127 ? 256 - velo[i] : velo[i];
if (ntrig[i] == 0) {
lastnote[i] = ___SMMUL((((uint32_t)(GenerateRandomNumber())) >> 2),
param_maxNote - param_minNote << 2) +
param_minNote;
PatchMidiInHandler(MIDI_DEVICE_INTERNAL, 0,
MIDI_NOTE_ON + (attr_channel - 1), lastnote[i],
velo[i]);
ntrig[i] = 1;
}
if (!(prev == inlet_touch + inlet_offset)) {
PatchMidiInHandler(MIDI_DEVICE_INTERNAL, 0,
MIDI_POLY_PRESSURE + (attr_channel - 1), lastnote[i],
velo[i]);
}
}
if ((!((inlet_trig > 0) && (i < generate))) && ntrig[i]) {
PatchMidiInHandler((midi_device_t)0, 0, MIDI_NOTE_OFF + (attr_channel - 1),
lastnote[i], velo[i]);
ntrig[i] = 0;
}
}
prev = inlet_touch + inlet_offset;