Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
USBMIDI_Sender Class Reference

#include <MIDI_Interfaces/USBMIDI_Sender.hpp>

Detailed Description

A class for sending MIDI USB messages.

Includes support for chunked MIDI USB SysEx messages.

Definition at line 12 of file USBMIDI_Sender.hpp.

+ Collaboration diagram for USBMIDI_Sender:

Public Member Functions

template<class Send >
void sendChannelMessage (ChannelMessage, Send &&send)
 Send a MIDI Channel message using the given sender.
 
template<class Send >
void sendSysCommonMessage (SysCommonMessage, Send &&send)
 Send a MIDI System Common message using the given sender.
 
template<class Send >
void sendRealTimeMessage (RealTimeMessage, Send &&send)
 Send a MIDI Real-Time message using the given sender.
 
template<class Send >
void sendSysEx (SysExMessage, Send &&send)
 Send a MIDI System Exclusive message using the given sender.
 
template<class Send >
void sendFullSysEx (SysExMessage, Send &&send)
 Send a MIDI System Exclusive message using the given sender.
 

Private Types

using CIN = MIDICodeIndexNumber
 

Private Member Functions

template<class Send >
void sendSysExStartCont1 (const uint8_t *data, Cable cable, Send &send)
 Send a single SysEx starts or continues USB packet.
 
template<class Send >
void sendSysExStartCont (const uint8_t *&data, uint16_t &length, Cable cable, Send &send)
 Send as many SysEx starts or continues USB packets, such that the remaining length is 3, 2 or 1 byte.
 
template<class Send >
void sendSysExEnd (const uint8_t *data, uint16_t length, Cable cable, Send &send)
 Send a SysExEnd USB packet.
 

Private Attributes

uint8_t storedSysExData [16][3]
 Stores remainder of outgoing SysEx chunks.
 
uint8_t storedSysExLength [16] = {}
 Number of remaining SysEx bytes stored.
 

Member Typedef Documentation

◆ CIN

using CIN = MIDICodeIndexNumber
private

Definition at line 70 of file USBMIDI_Sender.hpp.

Member Function Documentation

◆ sendChannelMessage()

template<class Send >
void sendChannelMessage ( ChannelMessage msg,
Send && send )

Send a MIDI Channel message using the given sender.

Definition at line 74 of file USBMIDI_Sender.hpp.

◆ sendSysCommonMessage()

template<class Send >
void sendSysCommonMessage ( SysCommonMessage msg,
Send && send )

Send a MIDI System Common message using the given sender.

Definition at line 82 of file USBMIDI_Sender.hpp.

◆ sendRealTimeMessage()

template<class Send >
void sendRealTimeMessage ( RealTimeMessage msg,
Send && send )

Send a MIDI Real-Time message using the given sender.

Definition at line 99 of file USBMIDI_Sender.hpp.

◆ sendSysEx()

template<class Send >
void sendSysEx ( SysExMessage msg,
Send && send )

Send a MIDI System Exclusive message using the given sender.

Message may be chunked, remaining bytes are stored until next chunk is sent.

Definition at line 153 of file USBMIDI_Sender.hpp.

◆ sendFullSysEx()

template<class Send >
void sendFullSysEx ( SysExMessage msg,
Send && send )

Send a MIDI System Exclusive message using the given sender.

Message should be complete, i.e. from SysEx Start to SysEx End.

Definition at line 106 of file USBMIDI_Sender.hpp.

◆ sendSysExStartCont1()

template<class Send >
void sendSysExStartCont1 ( const uint8_t * data,
Cable cable,
Send & send )
private

Send a single SysEx starts or continues USB packet.

Exactly 3 bytes are sent. The data pointer is not incremented.

Definition at line 126 of file USBMIDI_Sender.hpp.

◆ sendSysExStartCont()

template<class Send >
void sendSysExStartCont ( const uint8_t *& data,
uint16_t & length,
Cable cable,
Send & send )
private

Send as many SysEx starts or continues USB packets, such that the remaining length is 3, 2 or 1 byte.

The data pointer is incremented, and the length is decremented. The reason for leaving 3, 2 or 1 bytes remaining is so the message can be finished using a SysExEnd USB packet, which has to have 3, 2 or 1 bytes.

Definition at line 132 of file USBMIDI_Sender.hpp.

◆ sendSysExEnd()

template<class Send >
void sendSysExEnd ( const uint8_t * data,
uint16_t length,
Cable cable,
Send & send )
private

Send a SysExEnd USB packet.

The length should be either 3, 2 or 1 bytes, and the last byte of data should be a SysExEnd byte.

Definition at line 142 of file USBMIDI_Sender.hpp.

Member Data Documentation

◆ storedSysExData

uint8_t storedSysExData[16][3]
private

Stores remainder of outgoing SysEx chunks.

Each USB packet (except the last one) should contain a multiple of 3 SysEx bytes. If the SysEx chunk size is not a multiple of 3, there will be remaining bytes that can't be sent yet, until the next chunk arrives. See the comments in the USBMIDI_Sender::sendSysEx() implementation for more details.

Definition at line 64 of file USBMIDI_Sender.hpp.

◆ storedSysExLength

uint8_t storedSysExLength[16] = {}
private

Number of remaining SysEx bytes stored.

Definition at line 66 of file USBMIDI_Sender.hpp.


The documentation for this class was generated from the following file: