|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
A lock-free thread-safe vector of MidiEvents.
More...
#include <src/gui/dsp/midi_event.h>
Public Types | |
| using | ChordDescriptor = dsp::ChordDescriptor |
| using | Iterator = std::vector<MidiEvent>::iterator |
| using | ConstIterator = std::vector<MidiEvent>::const_iterator |
Public Member Functions | |
| Iterator | begin () |
| Iterator | end () |
| void | erase (Iterator it, Iterator it_end) |
| ConstIterator | begin () const |
| ConstIterator | end () const |
| void | push_back (const MidiEvent &ev) |
| void | push_back (const std::vector< MidiEvent > &events) |
| MidiEvent | pop_front () |
| MidiEvent | pop_back () |
| void | clear () |
| size_t | size () const |
| MidiEvent | front () const |
| MidiEvent | back () const |
| MidiEvent | at (size_t index) const |
| void | swap (MidiEventVector &other) |
| void | remove_if (std::function< bool(const MidiEvent &)> predicate) |
| void | remove (const MidiEvent &event) |
Removes all events that match event. | |
| size_t | capacity () const |
| void | print () const |
| void | append_w_filter (const MidiEventVector &src, std::optional< std::array< bool, 16 > > channels, nframes_t local_offset, nframes_t nframes) |
Appends the events from src. | |
| void | append (const MidiEventVector &src, nframes_t local_offset, nframes_t nframes) |
Appends the events from src. | |
| void | transform_chord_and_append (MidiEventVector &src, nframes_t local_offset, nframes_t nframes) |
| Transforms the given MIDI input to the MIDI notes of the corresponding chord. | |
| void | add_note_on (midi_byte_t channel, midi_byte_t note_pitch, midi_byte_t velocity, midi_time_t time) |
| Adds a note on event to the given MidiEvents. | |
| void | add_note_ons_from_chord_descr (const ChordDescriptor &descr, midi_byte_t channel, midi_byte_t velocity, midi_time_t time) |
| Adds a note on for each note in the chord. | |
| void | add_note_offs_from_chord_descr (const ChordDescriptor &descr, midi_byte_t channel, midi_time_t time) |
| Adds a note off for each note in the chord. | |
| void | add_cc_volume (midi_byte_t channel, midi_byte_t volume, midi_time_t time) |
| Add CC volume event. | |
| bool | has_any () const |
| bool | empty () const |
| void | add_event_from_buf (midi_time_t time, midi_byte_t *buf, int buf_size) |
| Parses a MidiEvent from a raw MIDI buffer. | |
| void | add_note_off (midi_byte_t channel, midi_byte_t note_pitch, midi_time_t time) |
| Adds a note off event to the given MidiEvents. | |
| void | add_control_change (midi_byte_t channel, midi_byte_t controller, midi_byte_t control, midi_time_t time) |
| Adds a control event to the given MidiEvents. | |
| void | add_song_pos (int64_t total_sixteenths, midi_time_t time) |
| Adds a song position event to the queue. | |
| void | add_raw (uint8_t *buf, size_t buf_sz, midi_time_t time) |
| void | add_simple (midi_byte_t byte1, midi_byte_t byte2, midi_byte_t byte3, midi_time_t time) |
| void | add_pitchbend (midi_byte_t channel, uint32_t pitchbend, midi_time_t time) |
| Adds a control event to the given MidiEvents. | |
| void | add_channel_pressure (midi_byte_t channel, midi_byte_t value, midi_time_t time) |
| void | add_all_notes_off (midi_byte_t channel, midi_time_t time, bool with_lock) |
| Queues MIDI note off to event queue. | |
| void | panic_without_lock () |
| Adds a note off message to every MIDI channel. | |
| void | panic () |
| Must only be called from the UI thread. | |
| void | write_to_midi_file (MIDI_FILE *mf, int midi_track) const |
| void | clear_duplicates () |
| Clears duplicates. | |
| void | sort () |
| Sorts the MidiEvents by time. | |
| void | set_channel (midi_byte_t channel) |
| Sets the given MIDI channel on all applicable MIDI events. | |
| void | delete_event (const MidiEvent *ev) |
A lock-free thread-safe vector of MidiEvents.
Not necessarily the best implementation, but it's good enough for now.
Definition at line 92 of file midi_event.h.
Definition at line 97 of file midi_event.h.
| using MidiEventVector::ConstIterator = std::vector<MidiEvent>::const_iterator |
Definition at line 101 of file midi_event.h.
| using MidiEventVector::Iterator = std::vector<MidiEvent>::iterator |
Definition at line 100 of file midi_event.h.
|
inline |
Definition at line 95 of file midi_event.h.
| void MidiEventVector::add_cc_volume | ( | midi_byte_t | channel, |
| midi_byte_t | volume, | ||
| midi_time_t | time ) |
Add CC volume event.
TODO
| void MidiEventVector::add_control_change | ( | midi_byte_t | channel, |
| midi_byte_t | controller, | ||
| midi_byte_t | control, | ||
| midi_time_t | time ) |
Adds a control event to the given MidiEvents.
| channel | MIDI channel starting from 1. |
| void MidiEventVector::add_event_from_buf | ( | midi_time_t | time, |
| midi_byte_t * | buf, | ||
| int | buf_size ) |
Parses a MidiEvent from a raw MIDI buffer.
This must be a full 3-byte message. If in 'running status' mode, the caller is responsible for prepending the status byte.
| void MidiEventVector::add_note_off | ( | midi_byte_t | channel, |
| midi_byte_t | note_pitch, | ||
| midi_time_t | time ) |
Adds a note off event to the given MidiEvents.
| channel | MIDI channel starting from 1. |
| queued | Add to queued events instead. |
| void MidiEventVector::add_note_on | ( | midi_byte_t | channel, |
| midi_byte_t | note_pitch, | ||
| midi_byte_t | velocity, | ||
| midi_time_t | time ) |
Adds a note on event to the given MidiEvents.
| channel | MIDI channel starting from 1. |
| queued | Add to queued events instead. |
| void MidiEventVector::add_pitchbend | ( | midi_byte_t | channel, |
| uint32_t | pitchbend, | ||
| midi_time_t | time ) |
Adds a control event to the given MidiEvents.
| channel | MIDI channel starting from 1. |
| pitchbend | 0 to 16384. |
|
inline |
Definition at line 342 of file midi_event.h.
| void MidiEventVector::add_song_pos | ( | int64_t | total_sixteenths, |
| midi_time_t | time ) |
Adds a song position event to the queue.
| total_sixteenths | Total sixteenths. |
| void MidiEventVector::append | ( | const MidiEventVector & | src, |
| nframes_t | local_offset, | ||
| nframes_t | nframes ) |
Appends the events from src.
| local_offset | The start frame offset from 0 in this cycle. |
| nframes | Number of frames to process. |
| void MidiEventVector::append_w_filter | ( | const MidiEventVector & | src, |
| std::optional< std::array< bool, 16 > > | channels, | ||
| nframes_t | local_offset, | ||
| nframes_t | nframes ) |
Appends the events from src.
| channels | Allowed channels (array of 16 booleans). |
| local_offset | The local offset from 0 in this cycle. |
| nframes | Number of frames to process. |
|
inline |
Definition at line 186 of file midi_event.h.
|
inline |
Definition at line 180 of file midi_event.h.
|
inline |
Definition at line 104 of file midi_event.h.
|
inline |
Definition at line 122 of file midi_event.h.
|
inline |
Definition at line 214 of file midi_event.h.
|
inline |
Definition at line 162 of file midi_event.h.
|
inline |
Definition at line 303 of file midi_event.h.
|
inline |
Definition at line 110 of file midi_event.h.
|
inline |
Definition at line 128 of file midi_event.h.
|
inline |
Definition at line 116 of file midi_event.h.
|
inline |
Definition at line 174 of file midi_event.h.
|
inline |
Definition at line 302 of file midi_event.h.
|
inline |
Adds a note off message to every MIDI channel.
Definition at line 372 of file midi_event.h.
|
inline |
Definition at line 154 of file midi_event.h.
|
inline |
Definition at line 146 of file midi_event.h.
|
inline |
Definition at line 134 of file midi_event.h.
|
inline |
Definition at line 140 of file midi_event.h.
|
inline |
Removes all events that match event.
Definition at line 209 of file midi_event.h.
|
inline |
Definition at line 198 of file midi_event.h.
|
inline |
Definition at line 168 of file midi_event.h.
|
inline |
Definition at line 192 of file midi_event.h.
| void MidiEventVector::transform_chord_and_append | ( | MidiEventVector & | src, |
| nframes_t | local_offset, | ||
| nframes_t | nframes ) |
Transforms the given MIDI input to the MIDI notes of the corresponding chord.
Only C0~B0 are considered.