|
Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
A lock-free thread-safe vector of MidiEvents. More...
#include <src/dsp/midi_event.h>
Public Types | |
| using | ChordDescriptor = dsp::ChordDescriptor |
| using | Iterator = std::vector<MidiEvent>::iterator |
| using | ConstIterator = std::vector<MidiEvent>::const_iterator |
| using | NotePitchToChordDescriptorFunc |
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. | |
| void | foreach_event (std::function< void(const MidiEvent &)> func) const |
| size_t | capacity () const |
| void | print () const |
| void | append_w_filter (const MidiEventVector &src, std::optional< std::array< bool, 16 > > channels, units::sample_u32_t local_offset, units::sample_u32_t nframes) |
Appends the events from src. | |
| void | append (const MidiEventVector &src, units::sample_u32_t local_offset, units::sample_u32_t nframes) |
Appends the events from src. | |
| void | transform_chord_and_append (const MidiEventVector &src, NotePitchToChordDescriptorFunc note_number_to_chord_descriptor, midi_byte_t velocity_to_use, units::sample_u32_t local_offset, units::sample_u32_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, units::sample_u32_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, units::sample_u32_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, units::sample_u32_t time) |
| Adds a note off for each note in the chord. | |
| void | add_cc_volume (midi_byte_t channel, midi_byte_t volume, units::sample_u32_t time) |
| Add CC volume event. | |
| bool | has_any () const |
| bool | empty () const |
| void | add_event_from_buf (units::sample_u32_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, units::sample_u32_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, units::sample_u32_t time) |
| Adds a control event to the given MidiEvents. | |
| void | add_song_pos (int64_t total_sixteenths, units::sample_u32_t time) |
| Adds a song position event to the queue. | |
| void | add_raw (const uint8_t *buf, size_t buf_sz, units::sample_u32_t time) |
| void | add_simple (midi_byte_t byte1, midi_byte_t byte2, midi_byte_t byte3, units::sample_u32_t time) |
| void | add_pitchbend (midi_byte_t channel, uint32_t pitchbend, units::sample_u32_t time) |
| Adds a control event to the given MidiEvents. | |
| void | add_channel_pressure (midi_byte_t channel, midi_byte_t value, units::sample_u32_t time) |
| void | add_all_notes_off (midi_byte_t channel, units::sample_u32_t time, bool with_lock) |
| Queues MIDI note off to event queue. | |
| void | panic_without_lock (units::sample_u32_t time) |
| Adds a note off message to every MIDI channel. | |
| void | panic () |
| Must only be called from the UI thread. | |
| void | write_to_midi_sequence (juce::MidiMessageSequence &sequence, bool update_matched_pairs) const |
| Writes the events to a MIDI sequence. | |
| 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 73 of file midi_event.h.
| using zrythm::dsp::MidiEventVector::ChordDescriptor = dsp::ChordDescriptor |
Definition at line 78 of file midi_event.h.
| using zrythm::dsp::MidiEventVector::ConstIterator = std::vector<MidiEvent>::const_iterator |
Definition at line 82 of file midi_event.h.
| using zrythm::dsp::MidiEventVector::Iterator = std::vector<MidiEvent>::iterator |
Definition at line 81 of file midi_event.h.
| using zrythm::dsp::MidiEventVector::NotePitchToChordDescriptorFunc |
Definition at line 235 of file midi_event.h.
|
inline |
Definition at line 76 of file midi_event.h.
| void zrythm::dsp::MidiEventVector::add_cc_volume | ( | midi_byte_t | channel, |
| midi_byte_t | volume, | ||
| units::sample_u32_t | time ) |
Add CC volume event.
TODO
| void zrythm::dsp::MidiEventVector::add_control_change | ( | midi_byte_t | channel, |
| midi_byte_t | controller, | ||
| midi_byte_t | control, | ||
| units::sample_u32_t | time ) |
Adds a control event to the given MidiEvents.
| channel | MIDI channel starting from 1. |
| void zrythm::dsp::MidiEventVector::add_event_from_buf | ( | units::sample_u32_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 zrythm::dsp::MidiEventVector::add_note_off | ( | midi_byte_t | channel, |
| midi_byte_t | note_pitch, | ||
| units::sample_u32_t | time ) |
Adds a note off event to the given MidiEvents.
| channel | MIDI channel starting from 1. |
| queued | Add to queued events instead. |
| void zrythm::dsp::MidiEventVector::add_note_on | ( | midi_byte_t | channel, |
| midi_byte_t | note_pitch, | ||
| midi_byte_t | velocity, | ||
| units::sample_u32_t | time ) |
Adds a note on event to the given MidiEvents.
| channel | MIDI channel starting from 1. |
| queued | Add to queued events instead. |
| void zrythm::dsp::MidiEventVector::add_pitchbend | ( | midi_byte_t | channel, |
| uint32_t | pitchbend, | ||
| units::sample_u32_t | time ) |
Adds a control event to the given MidiEvents.
| channel | MIDI channel starting from 1. |
| pitchbend | 0 to 16384. |
|
inline |
Definition at line 343 of file midi_event.h.
| void zrythm::dsp::MidiEventVector::add_song_pos | ( | int64_t | total_sixteenths, |
| units::sample_u32_t | time ) |
Adds a song position event to the queue.
| total_sixteenths | Total sixteenths. |
| void zrythm::dsp::MidiEventVector::append | ( | const MidiEventVector & | src, |
| units::sample_u32_t | local_offset, | ||
| units::sample_u32_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 zrythm::dsp::MidiEventVector::append_w_filter | ( | const MidiEventVector & | src, |
| std::optional< std::array< bool, 16 > > | channels, | ||
| units::sample_u32_t | local_offset, | ||
| units::sample_u32_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 167 of file midi_event.h.
|
inline |
Definition at line 161 of file midi_event.h.
|
inline |
Definition at line 85 of file midi_event.h.
|
inline |
Definition at line 103 of file midi_event.h.
|
inline |
Definition at line 203 of file midi_event.h.
|
inline |
Definition at line 143 of file midi_event.h.
|
inline |
Definition at line 301 of file midi_event.h.
|
inline |
Definition at line 91 of file midi_event.h.
|
inline |
Definition at line 109 of file midi_event.h.
|
inline |
Definition at line 97 of file midi_event.h.
|
inline |
Definition at line 197 of file midi_event.h.
|
inline |
Definition at line 155 of file midi_event.h.
|
inline |
Definition at line 300 of file midi_event.h.
|
inline |
Adds a note off message to every MIDI channel.
Definition at line 379 of file midi_event.h.
|
inline |
Definition at line 135 of file midi_event.h.
|
inline |
Definition at line 127 of file midi_event.h.
|
inline |
Definition at line 115 of file midi_event.h.
|
inline |
Definition at line 121 of file midi_event.h.
|
inline |
Removes all events that match event.
Definition at line 192 of file midi_event.h.
|
inline |
Definition at line 179 of file midi_event.h.
|
inline |
Definition at line 149 of file midi_event.h.
|
inline |
Definition at line 173 of file midi_event.h.
| void zrythm::dsp::MidiEventVector::transform_chord_and_append | ( | const MidiEventVector & | src, |
| NotePitchToChordDescriptorFunc | note_number_to_chord_descriptor, | ||
| midi_byte_t | velocity_to_use, | ||
| units::sample_u32_t | local_offset, | ||
| units::sample_u32_t | nframes ) |
Transforms the given MIDI input to the MIDI notes of the corresponding chord.
Only C0~B0 are considered.
| void zrythm::dsp::MidiEventVector::write_to_midi_sequence | ( | juce::MidiMessageSequence & | sequence, |
| bool | update_matched_pairs ) const |
Writes the events to a MIDI sequence.
This assumes that the event timestamps are in ticks.
| sequence | |
| update_matched_pairs | If true, ensures there are note off events for every note on event. |