My Project
Loading...
Searching...
No Matches
midi Class Reference

#include <midi_driver.h>

Classes

struct  midi_messages
 Struct that holds useful messgae template information. More...
 
struct  midi_struct
 Struct that contains information relating to this particular instance of midi. More...
 

Public Types

typedef struct midi::midi_struct midi_t
 Struct that contains information relating to this particular instance of midi.
 
typedef struct midi::midi_messages midi_messages
 Struct that holds useful messgae template information.
 

Public Member Functions

void note_on (uint32_t note)
 Create and buffer a MIDI note on message.
 
void note_off (uint32_t note)
 Create and buffer a MIDI note on message.
 
void cc_msg (uint32_t cc_num, uint32_t value)
 Create and buffer a MIDI CC message.
 
void send_midi ()
 Create and buffer a MIDI CC message.
 
 midi (uint32_t channel, UART_HandleTypeDef *uart_ptr)
 

Public Attributes

std::vector< uint8_t > msg_buf
 Buffer that holds all of the messages to be sent.
 
midi_t midi_struct {0,0}
 

Member Typedef Documentation

◆ midi_messages

Struct that holds useful messgae template information.

◆ midi_t

Struct that contains information relating to this particular instance of midi.

Constructor & Destructor Documentation

◆ midi()

midi::midi ( uint32_t  channel,
UART_HandleTypeDef uart_ptr 
)
inline

Member Function Documentation

◆ cc_msg()

void midi::cc_msg ( uint32_t  cc_num,
uint32_t  cc_val 
)

Create and buffer a MIDI CC message.

These messages tell the device to change a parameter.

The byte structure is as follows:
0xb*   **** ****   **** ****

MIDI CC, or MIDI Continuous Control, allows for non-note parameters of an instrument to be changed.
This would be akin to turning a knob on the instrument remotely. In practice, this can be taken
much further, with LFOs, pseudo-envelopes, and other control signals possible. There are 127 total
CC messages, which while not defined in any formal standard, have widely been standardized to
ensure consistent control between devices.

@param cc_num The particular CC number to be sent.
@param cc_val The CC value to be sent.

◆ note_off()

void midi::note_off ( uint32_t  note)

Create and buffer a MIDI note on message.

These messages tell the device that a note has been released.

The byte structure is as follows:
0x8*   **** ****   **** ****

Without sending a note off command, a note will keep playing as if it were held down - the actual
behaviour this creates is defined by the device being controlled. Interestingly, an 'on' note can
be given another note on command, in which case the note will retrigger. If this happens, it will
still just need one note off command to turn off.

@param note The note number to be turned off.

◆ note_on()

void midi::note_on ( uint32_t  note)

Create and buffer a MIDI note on message.

These messages tell the device that a note has been played

The byte structure is as follows:
0x9*   **** ****   **** ****

The first half of the status byte is the type of command (note on in this case). The second half is
the channel to send the message on. The data bytes give note and velocity, respectively. the
following example sends a middle C with velocity 100 on channel 10:

0x9A 0x3C 0x64

@param note The note number to be turned off.

◆ send_midi()

void midi::send_midi ( )

Create and buffer a MIDI CC message.

This function sends all queued messages in the buffer.

Member Data Documentation

◆ midi_struct

◆ msg_buf

std::vector<uint8_t> midi::msg_buf

Buffer that holds all of the messages to be sent.


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