Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
midi_event.h File Reference

MIDI events. More...

#include "zrythm-config.h"
#include <stdint.h>
#include <string.h>
#include "utils/types.h"
#include "zix/sem.h"
#include <gtk/gtk.h>
#include "ext/midilib/src/midifile.h"
Include dependency graph for midi_event.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

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

Macros

#define MAX_MIDI_EVENTS   2560
 Max events to hold in queues.
 

Functions

void midi_events_init (MidiEvents *self)
 Inits the MidiEvents struct.
 
MidiEventsmidi_events_new (void)
 Allocates and inits a MidiEvents struct.
 
NONNULL void midi_event_set_velocity (MidiEvent *ev, midi_byte_t vel)
 
void midi_event_print (const MidiEvent *ev)
 
void midi_events_print (MidiEvents *self, const int queued)
 
void midi_events_append (MidiEvents *dest, MidiEvents *src, const nframes_t local_offset, const nframes_t nframes, bool queued)
 Appends the events from src to dest.
 
void midi_events_transform_chord_and_append (MidiEvents *dest, MidiEvents *src, const nframes_t local_offset, const nframes_t nframes, bool queued)
 Transforms the given MIDI input to the MIDI notes of the corresponding chord.
 
OPTIMIZE_O3 void midi_events_append_w_filter (MidiEvents *dest, MidiEvents *src, int *channels, 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, const ChordDescriptor *descr, midi_byte_t channel, midi_byte_t velocity, midi_time_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, const ChordDescriptor *descr, midi_byte_t channel, midi_time_t time, bool queued)
 Adds a note off for each note in the chord.
 
void midi_events_add_cc_volume (MidiEvents *self, midi_byte_t channel, midi_byte_t volume, midi_time_t time, bool queued)
 Add CC volume event.
 
int midi_events_has_note_on (MidiEvents *self, int check_main, int check_queued)
 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, midi_time_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, midi_time_t time, int queued)
 Adds a control event to the given MidiEvents.
 
void midi_events_add_song_pos (MidiEvents *self, int64_t total_sixteenths, midi_time_t time, bool queued)
 Adds a song position event to the queue.
 
void midi_events_add_raw (MidiEvents *self, uint8_t *buf, size_t buf_sz, midi_time_t time, bool queued)
 
void midi_events_add_pitchbend (MidiEvents *self, midi_byte_t channel, uint32_t pitchbend, midi_time_t time, int queued)
 Adds a control event to the given MidiEvents.
 
void midi_events_add_all_notes_off (MidiEvents *self, midi_byte_t channel, midi_time_t time, bool queued)
 Queues MIDI note off to event queue.
 
NONNULL void midi_events_panic_without_lock (MidiEvents *self, bool queued)
 Adds a note off message to every MIDI channel.
 
NONNULL void midi_events_panic (MidiEvents *self, bool queued)
 Must only be called from the UI thread.
 
NONNULL void midi_events_write_to_midi_file (const MidiEvents *self, MIDI_FILE *mf, int midi_track)
 
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.
 
int midi_events_check_for_note_on (MidiEvents *midi_events, int note, int queued)
 Returns if a note on event for the given note exists in the given events.
 
int midi_events_delete_note_on (MidiEvents *midi_events, int note, int queued)
 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 bool 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_delete_event (MidiEvents *events, const MidiEvent *ev, const bool queued)
 
void midi_events_panic_all (const bool queued)
 Queues MIDI note off to event queues.
 
void midi_events_free (MidiEvents *self)
 Frees the MIDI events.
 

Detailed Description

MIDI events.

Definition in file midi_event.h.