MIDI Control Surface library for Arduino
|
Go to the documentation of this file.
5 #include <AH/STL/utility>
8 #include <Settings/SettingsWrapper.hpp>
10 #if defined(ESP32) || !defined(ARDUINO)
38 while (
stream.available() > 0) {
39 uint8_t midiByte =
stream.read();
41 if (parseResult != MIDIReadEvent::NO_MESSAGE)
44 return MIDIReadEvent::NO_MESSAGE;
50 void sendImpl(uint8_t header, uint8_t d1, uint8_t d2,
51 uint8_t cn)
override {
52 #if defined(ESP32) || !defined(ARDUINO)
53 std::lock_guard<std::mutex> lock(
mutex);
62 void sendImpl(uint8_t header, uint8_t d1, uint8_t cn)
override {
63 #if defined(ESP32) || !defined(ARDUINO)
64 std::lock_guard<std::mutex> lock(
mutex);
72 void sendImpl(
const uint8_t *data,
size_t length, uint8_t cn)
override {
73 #if defined(ESP32) || !defined(ARDUINO)
74 std::lock_guard<std::mutex> lock(
mutex);
77 stream.write(data, length);
81 void sendImpl(uint8_t rt, uint8_t cn)
override {
82 #if defined(ESP32) || !defined(ARDUINO)
83 std::lock_guard<std::mutex> lock(
mutex);
92 #if defined(ESP32) || !defined(ARDUINO)
172 #if !defined(TEENSYDUINO) || \
173 (defined(TEENSYDUINO) && defined(TEENSY_SERIALUSB_ENABLED))
197 #if defined(__AVR__) || (defined(TEENSYDUINO) && TEENSYDUINO != 147) || \
198 (defined(TEENSYDUINO) && !defined(__IMXRT1052__) && \
199 !defined(__IMXRT1062__))
201 #include <SoftwareSerial.h>
void sendImpl(uint8_t rt, uint8_t cn) override
Low-level function for sending a single-byte MIDI message.
A class for MIDI interfaces sending and receiving MIDI messages over a SoftwareSerial interface.
A wrapper class for MIDI interfaces sending and receiving MIDI messages over a Serial port of generic...
constexpr unsigned long HAIRLESS_BAUD
The baud rate to use for Hairless MIDI.
void sendImpl(uint8_t header, uint8_t d1, uint8_t d2, uint8_t cn) override
Low-level function for sending a 3-byte MIDI message.
void sendImpl(const uint8_t *data, size_t length, uint8_t cn) override
Low-level function for sending a system exclusive MIDI message.
An abstract class for MIDI interfaces.
#define BEGIN_CS_NAMESPACE
A class for MIDI interfaces sending and receiving MIDI messages over the Serial port of the USB conne...
MIDIReadEvent read() override
Try reading and parsing a single incoming MIDI message.
SerialMIDI_Interface(T &serial, unsigned long baud=MIDI_BAUD)
Create a new MIDI Interface on the given Serial interface with the given baud rate.
SoftwareSerialMIDI_Interface(SoftwareSerial &serial, unsigned long baud)
Create a SoftwareSerialMIDI_Interface on the given SoftwareSerial interface with the given baud rate.
A class for MIDI Interfaces sending and receiving data over the USB Serial CDC connection for the use...
StreamMIDI_Interface(StreamMIDI_Interface &&other)
A class for MIDI interfaces sending and receiving MIDI messages over a Hardware Serial port.
void sendImpl(uint8_t header, uint8_t d1, uint8_t cn) override
Low-level function for sending a 2-byte MIDI message.
StreamMIDI_Interface(Stream &stream)
Construct a StreamMIDI_Interface on the given Stream.
USBSerialMIDI_Interface(unsigned long baud)
Construct a USBSerialMIDI_Interface with the given baud rate.
HairlessMIDI_Interface()
Construct a HairlessMIDI_Interface.
void begin() override
Start the Serial interface at the predefined baud rate.
MIDIReadEvent parse(uint8_t midibyte)
MIDIReadEvent
Result of the MIDI interface read methods.
A class for MIDI interfaces sending and receiving MIDI messages over a Stream.
HardwareSerialMIDI_Interface(HardwareSerial &serial, unsigned long baud=MIDI_BAUD)
Construct a new MIDI Interface on the given HardwareSerial interface with the given baud rate.