|
Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
USB MIDI device port (static class) More...
USB MIDI device port (static class)
All methods are safe to call from main loop context. Not ISR-safe — TinyUSB device stack is not reentrant.
#include <midi.hpp>
Static Public Member Functions | |
| static bool | connected () |
| Check if USB MIDI interface is mounted by host. | |
| static uint32_t | read (uint8_t *buf, uint32_t max_len) |
| Read decoded MIDI bytes from USB (RX) | |
| static bool | send (const sbl::midi::MidiEvent &event, uint8_t port=0) |
| Send a MidiEvent over USB MIDI (TX) | |
| static uint32_t | write (const uint8_t *data, uint32_t len, uint8_t port=0) |
| Write raw MIDI bytes to USB MIDI (TX) | |
| static uint8_t | out_port_count () |
| How many output ports this target has. | |
|
static |
|
static |
Read decoded MIDI bytes from USB (RX)
TinyUSB unpacks 4-byte USB MIDI Event Packets into standard MIDI byte stream. Feed the output directly to sbl::midi::Parser::push().
| buf | Buffer to receive MIDI bytes |
| max_len | Maximum bytes to read |
|
static |
Send a MidiEvent over USB MIDI (TX)
Converts the event to standard MIDI bytes and writes them via tud_midi_stream_write(), which handles USB packet framing.
| event | The MIDI event to send |
| port | Output port, 0 to out_port_count() - 1 |
|
static |
Write raw MIDI bytes to USB MIDI (TX)
TinyUSB packs bytes into 4-byte USB MIDI Event Packets.
| data | Raw MIDI bytes to send |
| len | Number of bytes |
| port | Output port, 0 to out_port_count() - 1 |
|
static |