Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
sbl::midi::MidiEvent Struct Reference

#include <types.hpp>

Collaboration diagram for sbl::midi::MidiEvent:

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.
 

Public Attributes

MessageType type = MessageType::None
 
uint8_t channel = 0
 0-15 for channel messages, 0 for system
 
uint8_t data1 = 0
 Note number, CC number, program, etc.
 
uint8_t data2 = 0
 Velocity, CC value, etc.
 

Detailed Description

Definition at line 39 of file types.hpp.

Member Function Documentation

◆ cc_number()

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

CC number (alias for data1)

Definition at line 52 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 55 of file types.hpp.

References data2.

◆ note()

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

Note number (alias for data1)

Definition at line 46 of file types.hpp.

References data1.

◆ pitch_bend_raw()

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

Raw 14-bit pitch bend (0-16383)

Definition at line 67 of file types.hpp.

References data1, and 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 62 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 76 of file types.hpp.

References sbl::midi::ActiveSensing, channel, sbl::midi::ChannelPressure, sbl::midi::Clock, sbl::midi::Continue, sbl::midi::ControlChange, data1, data2, sbl::midi::NoteOff, sbl::midi::NoteOn, sbl::midi::PitchBend, sbl::midi::PolyPressure, sbl::midi::ProgramChange, sbl::midi::SongPosition, sbl::midi::SongSelect, sbl::midi::Start, sbl::midi::Stop, sbl::midi::SystemReset, sbl::midi::TuneRequest, and type.

◆ velocity()

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

Velocity (alias for data2)

Definition at line 49 of file types.hpp.

References data2.

Member Data Documentation

◆ channel

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

0-15 for channel messages, 0 for system

Definition at line 41 of file types.hpp.

Referenced by to_bytes().

◆ data1

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

Note number, CC number, program, etc.

Definition at line 42 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 43 of file types.hpp.

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

◆ type

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

Definition at line 40 of file types.hpp.

Referenced by sbl::midi::Parser::push(), and to_bytes().


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