Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
sbl::midi::MidiEvent Struct Reference

Detailed Description

Definition at line 61 of file types.hpp.

Public Member Functions

uint8_t note () const
 Note number (alias for data1)
 
uint8_t velocity () const
 Velocity (alias for data2)
 
uint8_t cc_number () const
 CC number (alias for data1)
 
uint8_t cc_value () const
 CC value (alias for data2)
 
int16_t pitch_bend_value () const
 14-bit pitch bend value, centered at 8192
 
uint16_t pitch_bend_raw () const
 Raw 14-bit pitch bend (0-16383)
 
uint8_t to_bytes (uint8_t *out) const
 Encode this event as raw MIDI bytes.
 

Static Public Member Functions

static constexpr MidiEvent control_change (uint8_t channel, uint8_t number, uint8_t value)
 A Control Change event: channel 0-15, controller number and value 0-127.
 

Public Attributes

MessageType type = MessageType::None
 
uint8_t channel = 0
 
uint8_t data1 = 0
 
uint8_t data2 = 0
 

Member Function Documentation

◆ control_change()

static constexpr MidiEvent sbl::midi::MidiEvent::control_change ( uint8_t  channel,
uint8_t  number,
uint8_t  value 
)
inlinestaticconstexpr

A Control Change event: channel 0-15, controller number and value 0-127.

Definition at line 68 of file types.hpp.

References channel.

Referenced by sbl::control::ParamEcho< Target >::poll().

◆ note()

uint8_t sbl::midi::MidiEvent::note ( ) const
inline

Note number (alias for data1)

Definition at line 78 of file types.hpp.

References data1.

◆ velocity()

uint8_t sbl::midi::MidiEvent::velocity ( ) const
inline

Velocity (alias for data2)

Definition at line 81 of file types.hpp.

References data2.

◆ cc_number()

uint8_t sbl::midi::MidiEvent::cc_number ( ) const
inline

CC number (alias for data1)

Definition at line 84 of file types.hpp.

References data1.

◆ cc_value()

uint8_t sbl::midi::MidiEvent::cc_value ( ) const
inline

CC value (alias for data2)

Definition at line 87 of file types.hpp.

References data2.

◆ pitch_bend_value()

int16_t sbl::midi::MidiEvent::pitch_bend_value ( ) const
inline

14-bit pitch bend value, centered at 8192

Range: 0 (max down) to 16383 (max up), 8192 = center.

Definition at line 94 of file types.hpp.

References data1, and data2.

◆ pitch_bend_raw()

uint16_t sbl::midi::MidiEvent::pitch_bend_raw ( ) const
inline

Raw 14-bit pitch bend (0-16383)

Definition at line 97 of file types.hpp.

References data1, and data2.

◆ to_bytes()

uint8_t sbl::midi::MidiEvent::to_bytes ( uint8_t *  out) const
inline

Encode this event as raw MIDI bytes.

Parameters
outBuffer for MIDI bytes (must be at least 3 bytes)
Returns
Number of bytes written (0 if unsupported message type)

Definition at line 104 of file types.hpp.

References channel, data1, and data2.

Member Data Documentation

◆ type

MessageType sbl::midi::MidiEvent::type = MessageType::None

Definition at line 62 of file types.hpp.

◆ channel

uint8_t sbl::midi::MidiEvent::channel = 0

0-15 for channel messages, 0 for system

Definition at line 63 of file types.hpp.

Referenced by control_change(), and to_bytes().

◆ data1

uint8_t sbl::midi::MidiEvent::data1 = 0

Note number, CC number, program, etc.

Definition at line 64 of file types.hpp.

Referenced by cc_number(), note(), pitch_bend_raw(), pitch_bend_value(), and to_bytes().

◆ data2

uint8_t sbl::midi::MidiEvent::data2 = 0

Velocity, CC value, etc.

Definition at line 65 of file types.hpp.

Referenced by cc_value(), pitch_bend_raw(), pitch_bend_value(), to_bytes(), and velocity().


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