Class for using a serial connection as a MIDI source. More...
#include <serialmidi.h>
Public Member Functions | |
SerialMidi (std::string serialPath) | |
void | run () |
Parse MIDI messages. | |
Notes & | getNotes () |
Get Notes reference. |
Class for using a serial connection as a MIDI source.
SerialMidi is a class implementing IMidiSource, parsing MIDI messages received on the given serial port.
The baudrate is statically set to 38400, which corresponds to 31250 on a Raspberry Pi with modified serial clock.
SerialMidi parses NoteOn and NoteOff messages destined to channel 0.
Definition at line 21 of file serialmidi.h.
SerialMidi::SerialMidi | ( | std::string | serialPath | ) |
Construct a SerialMidi object.
Use "/dev/ttyAMA0" for the serialPath on the Raspberry Pi.
serialPath | Path pointing to serial device on which MIDI messages are received. |
Definition at line 12 of file serialmidi.cpp.
|
virtual |
Get Notes reference.
Get a reference to the Notes object which receives its notes from the parsed MIDI data.
Implements IMidiSource.
Definition at line 87 of file serialmidi.cpp.
|
virtual |
Parse MIDI messages.
Start parsing MIDI data on the serial connection. This is a blocking call. Any received notes will be stored in the Notes object to which a reference can be retrieved with getNotes().
Implements IMidiSource.
Definition at line 36 of file serialmidi.cpp.