Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::midi::MidiEvent Struct Reference

Timestamped MIDI event combining a choc::midi::ShortMessage with timing info. More...

#include <message.hpp>

Public Member Functions

const uint8_t * data () const
 Raw MIDI byte data (for format adapters that need direct byte access).
uint32_t size () const
 Number of bytes in the MIDI message (1-3).
bool is_note_on () const
bool is_note_off () const
bool is_cc () const
bool is_pitch_bend () const
bool is_program_change () const
bool is_poly_pressure () const
uint8_t channel () const
 MIDI channel (0-15).
uint8_t note () const
uint8_t velocity () const
uint8_t cc_number () const
uint8_t cc_value () const

Static Public Member Functions

static MidiEvent note_on (uint8_t channel, uint8_t note, uint8_t velocity)
 Create a Note On event.
static MidiEvent note_off (uint8_t channel, uint8_t note, uint8_t velocity=0)
 Create a Note Off event.
static MidiEvent cc (uint8_t channel, uint8_t controller, uint8_t value)
 Create a Control Change event.
static MidiEvent pitch_bend (uint8_t channel, uint16_t value)
 Create a Pitch Bend event.
static MidiEvent poly_pressure (uint8_t channel, uint8_t note, uint8_t pressure)
 Create a Polyphonic Key Pressure (poly aftertouch) event.
static MidiEvent program_change (uint8_t channel, uint8_t program)
 Create a Program Change event.

Public Attributes

choc::midi::ShortMessage message
int32_t sample_offset = 0
 Sample position within the current buffer block.
double timestamp = 0.0
 Absolute time in seconds (for device I/O).

Detailed Description

Timestamped MIDI event combining a choc::midi::ShortMessage with timing info.

Two timing fields serve different contexts:

  • sample_offset for sample-accurate positioning within a processing block.
  • timestamp for absolute time in device I/O scenarios.

Factory methods create common message types. Query methods delegate to choc::midi for parsing.

Member Function Documentation

◆ cc()

MidiEvent pulp::midi::MidiEvent::cc ( uint8_t channel,
uint8_t controller,
uint8_t value )
inlinestatic

Create a Control Change event.

Parameters
controllerCC number (0-127).
valueCC value (0-127).

◆ cc_number()

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

◆ cc_value()

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

◆ channel()

uint8_t pulp::midi::MidiEvent::channel ( ) const
inline

MIDI channel (0-15).

◆ data()

const uint8_t * pulp::midi::MidiEvent::data ( ) const
inline

Raw MIDI byte data (for format adapters that need direct byte access).

◆ is_cc()

bool pulp::midi::MidiEvent::is_cc ( ) const
inline

◆ is_note_off()

bool pulp::midi::MidiEvent::is_note_off ( ) const
inline

◆ is_note_on()

bool pulp::midi::MidiEvent::is_note_on ( ) const
inline

◆ is_pitch_bend()

bool pulp::midi::MidiEvent::is_pitch_bend ( ) const
inline

◆ is_poly_pressure()

bool pulp::midi::MidiEvent::is_poly_pressure ( ) const
inline

◆ is_program_change()

bool pulp::midi::MidiEvent::is_program_change ( ) const
inline

◆ note()

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

◆ note_off()

MidiEvent pulp::midi::MidiEvent::note_off ( uint8_t channel,
uint8_t note,
uint8_t velocity = 0 )
inlinestatic

Create a Note Off event.

◆ note_on()

MidiEvent pulp::midi::MidiEvent::note_on ( uint8_t channel,
uint8_t note,
uint8_t velocity )
inlinestatic

Create a Note On event.

Parameters
channelMIDI channel (0-15).
noteNote number (0-127).
velocityVelocity (0-127).

◆ pitch_bend()

MidiEvent pulp::midi::MidiEvent::pitch_bend ( uint8_t channel,
uint16_t value )
inlinestatic

Create a Pitch Bend event.

Parameters
value14-bit pitch bend value (0-16383, center = 8192).

◆ poly_pressure()

MidiEvent pulp::midi::MidiEvent::poly_pressure ( uint8_t channel,
uint8_t note,
uint8_t pressure )
inlinestatic

Create a Polyphonic Key Pressure (poly aftertouch) event.

Distinct from channel pressure (status 0xD0), which applies to every sounding note on the channel: poly pressure targets one key.

Parameters
noteNote number (0-127) the pressure applies to.
pressurePressure (0-127).

◆ program_change()

MidiEvent pulp::midi::MidiEvent::program_change ( uint8_t channel,
uint8_t program )
inlinestatic

Create a Program Change event.

◆ size()

uint32_t pulp::midi::MidiEvent::size ( ) const
inline

Number of bytes in the MIDI message (1-3).

◆ velocity()

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

Member Data Documentation

◆ message

choc::midi::ShortMessage pulp::midi::MidiEvent::message

◆ sample_offset

int32_t pulp::midi::MidiEvent::sample_offset = 0

Sample position within the current buffer block.

◆ timestamp

double pulp::midi::MidiEvent::timestamp = 0.0

Absolute time in seconds (for device I/O).


The documentation for this struct was generated from the following file:
  • /home/runner/work/pulp/pulp/core/midi/include/pulp/midi/message.hpp