Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
midi.hpp File Reference

USB MIDI device interface. More...

Detailed Description

USB MIDI device interface.

Provides bidirectional USB MIDI 1.0 via TinyUSB's MIDI device class. Operates on cable 0 (single virtual cable).

RX path: tud_midi_stream_read() → raw MIDI bytes → feed to sbl::midi::Parser TX path: MidiEvent → raw MIDI bytes → tud_midi_stream_write()

Output ports. A USB device has one cable, so hardware targets have one output port and port is always 0. A target that offers more says so through out_port_count(): the workbench gives an app several, which is what a multi-voice sequencer sends into (FDP-078).

Requires CFG_TUD_MIDI=1 in tusb_config.h and the composite CDC+MIDI descriptor in usb_descriptors.c.

Usage: // RX: poll in main loop (or use sbl::midi::poll_usb()) uint8_t buf[64]; uint32_t n = sbl::usb::MidiPort::read(buf, sizeof(buf)); parser.push(buf, n);

// TX: send events sbl::usb::MidiPort::send(event);

Definition in file midi.hpp.

#include <cstdint>
#include <sbl/protocol/midi/types.hpp>

Go to the source code of this file.

Classes

class  sbl::usb::MidiPort
 USB MIDI device port (static class) More...
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::usb
 USB device classes.