25 return tud_midi_mounted();
29 if (!tud_midi_mounted())
return 0;
30 return tud_midi_stream_read(buf, max_len);
34 if (port != 0 || !tud_midi_mounted())
return false;
37 uint8_t len =
event.to_bytes(msg);
38 if (len == 0)
return false;
40 return tud_midi_stream_write(CABLE_NUM, msg, len) == len;
44 if (port != 0 || !tud_midi_mounted())
return 0;
45 return tud_midi_stream_write(CABLE_NUM, data, len);
static bool connected()
Check if USB MIDI interface is mounted by host.
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 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)
USB MIDI device interface.
constexpr uint8_t OUT_PORTS
A USB device has one cable, so one output port.
constexpr uint8_t CABLE_NUM
Cable number for our single virtual MIDI cable.