| 432 | |
| 433 | #if DISTRHO_PLUGIN_WANT_MIDI_INPUT |
| 434 | void sendNote(const uint8_t channel, const uint8_t note, const uint8_t velocity) |
| 435 | { |
| 436 | DISTRHO_SAFE_ASSERT_RETURN(fWriteFunction != nullptr,); |
| 437 | |
| 438 | if (channel > 0xF) |
| 439 | return; |
| 440 | |
| 441 | const uint32_t eventInPortIndex = DISTRHO_PLUGIN_NUM_INPUTS + DISTRHO_PLUGIN_NUM_OUTPUTS; |
| 442 | |
| 443 | LV2_Atom_MidiEvent atomMidiEvent; |
| 444 | atomMidiEvent.atom.size = 3; |
| 445 | atomMidiEvent.atom.type = fURIDs.midiEvent; |
| 446 | |
| 447 | atomMidiEvent.data[0] = channel + (velocity != 0 ? 0x90 : 0x80); |
| 448 | atomMidiEvent.data[1] = note; |
| 449 | atomMidiEvent.data[2] = velocity; |
| 450 | |
| 451 | // send to DSP side |
| 452 | fWriteFunction(fController, eventInPortIndex, lv2_atom_total_size(&atomMidiEvent.atom), |
| 453 | fURIDs.atomEventTransfer, &atomMidiEvent); |
| 454 | } |
| 455 | |
| 456 | static void sendNoteCallback(void* const ptr, const uint8_t channel, const uint8_t note, const uint8_t velocity) |
| 457 | { |
no test coverage detected