My Project
|
: Class that handles sending midi messages More...
#include "midi_driver.h"
Variables | |
midi::midi_messages | messages = {0x90, 0x80, 0xb0} |
MIDI can play a total of 128 notes, which totals between 10 and 11 full octaves. | |
std::vector< uint8_t > | msg_buf |
: Class that handles sending midi messages
Brief description. This class defines a midi object, which can be used to send note on, note off, and midi cc messages.
The note_on, note_off, and cc_msg functions add the desired MIDI message to a buffer. The send_midi function sends all the messages in this buffer, then clears it. This is because MIDI sends data using UART, so sending all of the queued messages as a single transmission is more efficient than sending individual messages, as it avoids the start and stop bytes.
midi::midi_messages messages = {0x90, 0x80, 0xb0} |
MIDI can play a total of 128 notes, which totals between 10 and 11 full octaves.
A 60 is middle C (C4), and all other notes are generally referred to in reference to this datum.
A MIDI message consists of three bytes
The first is a status byte, the next two are data bytes. Every status byte starts with a 1, every data byte starts with a 0. So, in hex, the status bytes are all 0x80 or up, and the data bytes are all 0x7F and below. The channel indicates which device a message is meant to controll - all peripherals reading channel 4 will only take channel 4 inputs, and a device can only send MIDI on one channel at a time. Midi message prefixes
std::vector<uint8_t> msg_buf |
The buffer that the midi messages to be sent are stored in