frac32.bipolar note (-64..63)
frac32.bipolar note2
frac32.bipolar note3
frac32.bipolar note4
frac32.positive velocity
frac32.positive velo2
frac32.positive velo3
frac32.positive velo4
bool32.rising trigger
bool32.rising trig2
bool32.rising trig3
bool32.rising trig4
None
int32 ch1
int32 ch2
int32 ch3
int32 ch4
combo d
int ntrig1;
int lastnote1;
int ntrig2;
int lastnote2;
int ntrig3;
int lastnote3;
int ntrig4;
int lastnote4;
ntrig1 = 0;
ntrig2 = 0;
ntrig3 = 0;
ntrig4 = 0;
// Ch1 //
{
if ((inlet_trig1 > 0) && !ntrig1) {
lastnote1 = (64 + (inlet_note1 >> 21)) & 0x7F;
MidiSend3((midi_device_t)attr_d, MIDI_NOTE_ON + (param_ch1 - 1), lastnote1,
inlet_velo1 >> 20);
ntrig1 = 1;
}
if (!(inlet_trig1 > 0) && ntrig1) {
MidiSend3((midi_device_t)attr_d, MIDI_NOTE_OFF + (param_ch1 - 1), lastnote1,
__USAT(inlet_velo1 >> 20, 7));
ntrig1 = 0;
}
}
// Ch2 //
{
if ((inlet_trig2 > 0) && !ntrig2) {
lastnote2 = (64 + (inlet_note2 >> 21)) & 0x7F;
MidiSend3((midi_device_t)attr_d, MIDI_NOTE_ON + (param_ch2 - 1), lastnote2,
inlet_velo2 >> 20);
ntrig2 = 1;
}
if (!(inlet_trig2 > 0) && ntrig2) {
MidiSend3((midi_device_t)attr_d, MIDI_NOTE_OFF + (param_ch2 - 1), lastnote2,
__USAT(inlet_velo2 >> 20, 7));
ntrig2 = 0;
}
}
// Ch3 //
{
if ((inlet_trig3 > 0) && !ntrig3) {
lastnote3 = (64 + (inlet_note3 >> 21)) & 0x7F;
MidiSend3((midi_device_t)attr_d, MIDI_NOTE_ON + (param_ch3 - 1), lastnote3,
inlet_velo3 >> 20);
ntrig3 = 1;
}
if (!(inlet_trig3 > 0) && ntrig3) {
MidiSend3((midi_device_t)attr_d, MIDI_NOTE_OFF + (param_ch3 - 1), lastnote3,
__USAT(inlet_velo3 >> 20, 7));
ntrig3 = 0;
}
}
// Ch4 //
{
if ((inlet_trig4 > 0) && !ntrig4) {
lastnote4 = (64 + (inlet_note4 >> 21)) & 0x7F;
MidiSend3((midi_device_t)attr_d, MIDI_NOTE_ON + (param_ch4 - 1), lastnote4,
inlet_velo4 >> 20);
ntrig4 = 1;
}
if (!(inlet_trig4 > 0) && ntrig4) {
MidiSend3((midi_device_t)attr_d, MIDI_NOTE_OFF + (param_ch4 - 1), lastnote4,
__USAT(inlet_velo4 >> 20, 7));
ntrig4 = 0;
}
}