audio/midi_event.h file

Contents

MIDI events.

Classes

struct MidiEvent
Backend-agnostic MIDI event descriptor.
struct MidiEvents
Container for passing midi events through ports.
struct MidiEventHeader
Used by Windows MME and RtMidi when adding events to the ring.

Enums

enum MidiEventType { MIDI_EVENT_TYPE_PITCHBEND, MIDI_EVENT_TYPE_CONTROLLER, MIDI_EVENT_TYPE_NOTE_OFF, MIDI_EVENT_TYPE_NOTE_ON, MIDI_EVENT_TYPE_ALL_NOTES_OFF }
Type of MIDI event.

Typedefs

using MidiEventType = enum MidiEventType
Type of MIDI event.
using MidiEvent = struct MidiEvent
Backend-agnostic MIDI event descriptor.
using MidiEvents = struct MidiEvents
Container for passing midi events through ports.
using MidiEventHeader = struct MidiEventHeader
Used by Windows MME and RtMidi when adding events to the ring.

Functions

void midi_events_init(MidiEvents* self)
Inits the MidiEvents struct.
auto midi_events_new(Port* port) -> MidiEvents*
Allocates and inits a MidiEvents struct.
static void midi_event_copy(MidiEvent* src, MidiEvent* dest)
Copies the members from one MidiEvent to another.
void midi_events_sort_by_time(MidiEvents* self)
Sorts the MIDI events by time ascendingly.
void midi_events_append(MidiEvents* src, MidiEvents* dest, const nframes_t start_frame, const nframes_t nframes, bool queued)
Appends the events from src to dest.
void midi_events_add_note_on(MidiEvents* self, midi_byte_t channel, midi_byte_t note_pitch, midi_byte_t velocity, midi_time_t time, int queued)
Adds a note on event to the given MidiEvents.
void midi_events_add_note_ons_from_chord_descr(MidiEvents* self, ChordDescriptor* descr, midi_byte_t channel, midi_byte_t velocity, midi_byte_t time, bool queued)
Adds a note on for each note in the chord.
void midi_events_add_note_offs_from_chord_descr(MidiEvents* self, ChordDescriptor* descr, midi_byte_t channel, midi_byte_t time, bool queued)
Adds a note off for each note in the chord.
auto midi_events_has_note_on(MidiEvents* self, int check_main, int check_queued) -> int
Returrns if the MidiEvents have any note on events.
void midi_events_add_event_from_buf(MidiEvents* self, midi_time_t time, midi_byte_t* buf, int buf_size, int queued)
Parses a MidiEvent from a raw MIDI buffer.
void midi_events_add_note_off(MidiEvents* self, midi_byte_t channel, midi_byte_t note_pitch, uint32_t time, int queued)
Adds a note off event to the given MidiEvents.
void midi_events_add_control_change(MidiEvents* self, midi_byte_t channel, midi_byte_t controller, midi_byte_t control, uint32_t time, int queued)
Adds a control event to the given MidiEvents.
void midi_events_add_pitchbend(MidiEvents* self, midi_byte_t channel, int pitchbend, midi_time_t time, int queued)
Adds a control event to the given MidiEvents.
void midi_events_panic(MidiEvents* self, int queued)
Queues MIDI note off to event queue.
void midi_events_clear(MidiEvents* midi_events, int queued)
Clears midi events.
void midi_events_clear_duplicates(MidiEvents* midi_events, const int queued)
Clears duplicates.
void midi_events_dequeue(MidiEvents* midi_events)
Copies the queue contents to the original struct.
auto midi_events_check_for_note_on(MidiEvents* midi_events, int note, int queued) -> int
Returns if a note on event for the given note exists in the given events.
auto midi_events_delete_note_on(MidiEvents* midi_events, int note, int queued) -> int
Deletes the midi event with a note on signal from the queue, and returns if it deleted or not.
void midi_events_sort(MidiEvents* self, const int queued)
Sorts the MidiEvents by time.
void midi_events_set_channel(MidiEvents* self, const int queued, const midi_byte_t channel)
Sets the given MIDI channel on all applicable MIDI events.
void midi_events_free(MidiEvents* self)
Frees the MIDI events.

Defines

#define MAX_MIDI_EVENTS
Max events to hold in queues.