|
Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
|
Type-erased MIDI event with small-buffer optimization. More...
#include <src/dsp/midi_event.h>
Public Types | |
| using | InlineStorage = std::array<midi_byte_t, sizeof (const midi_byte_t *)> |
| using | ExternalStorage = std::shared_ptr<const midi_byte_t[]> |
| using | TimeType = TimeT |
Public Member Functions | |
| template<typename OtherTimeType> | |
| MidiEvent (const MidiEvent< OtherTimeType > &other) noexcept | |
| Converting constructor for compatible time types. | |
| std::span< const midi_byte_t > | data () const noexcept |
| void | set_inline (std::span< const midi_byte_t > d) noexcept |
| void | set_inline_rt (std::span< const midi_byte_t > d) noexcept |
| RT-safe version of set_inline that only works on inline storage. | |
| void | set_external (std::shared_ptr< const midi_byte_t[]> ptr, uint16_t sz) noexcept |
| bool | is_inline () const noexcept |
Data Fields | |
| std::variant< InlineStorage, ExternalStorage > | storage |
| uint16_t | size_ {} |
| Number of valid MIDI bytes. | |
| TimeType | time_ {} |
| Timestamp (meaning depends on TimeType). | |
Static Public Attributes | |
| static constexpr size_t | inline_capacity = InlineStorage{}.size () |
Friends | |
| bool | operator== (const MidiEvent &lhs, const MidiEvent &rhs) noexcept |
Type-erased MIDI event with small-buffer optimization.
Stores channel messages (≤3 bytes) inline in a fixed-size array sized to sizeof(pointer), and larger messages (e.g. sysex) via shared heap storage.
| TimeT | The timestamp type (e.g. units::sample_t, units::precise_tick_t). |
Definition at line 34 of file midi_event.h.
| using zrythm::dsp::MidiEvent< TimeT >::ExternalStorage = std::shared_ptr<const midi_byte_t[]> |
Definition at line 37 of file midi_event.h.
| using zrythm::dsp::MidiEvent< TimeT >::InlineStorage = std::array<midi_byte_t, sizeof (const midi_byte_t *)> |
Definition at line 36 of file midi_event.h.
| using zrythm::dsp::MidiEvent< TimeT >::TimeType = TimeT |
Definition at line 38 of file midi_event.h.
|
inlinenoexcept |
Converting constructor for compatible time types.
Allows implicit conversion e.g. from MidiEvent<Quantity<Sample, int>> to MidiEvent<Quantity<Sample, long>> (SampleBasedMidiEvent).
Definition at line 60 of file midi_event.h.
|
inlinenoexcept |
Definition at line 66 of file midi_event.h.
|
inlinenoexcept |
Definition at line 116 of file midi_event.h.
|
inlinenoexcept |
Definition at line 109 of file midi_event.h.
|
inlinenoexcept |
Definition at line 82 of file midi_event.h.
|
inlinenoexcept |
RT-safe version of set_inline that only works on inline storage.
Asserts if the variant currently holds external storage — this must only be called on freshly-constructed or already-inline events.
Definition at line 99 of file midi_event.h.
|
friend |
Definition at line 121 of file midi_event.h.
|
staticconstexpr |
Definition at line 40 of file midi_event.h.
| uint16_t zrythm::dsp::MidiEvent< TimeT >::size_ {} |
Number of valid MIDI bytes.
Definition at line 46 of file midi_event.h.
| std::variant<InlineStorage, ExternalStorage> zrythm::dsp::MidiEvent< TimeT >::storage |
Definition at line 45 of file midi_event.h.
| TimeType zrythm::dsp::MidiEvent< TimeT >::time_ {} |
Timestamp (meaning depends on TimeType).
Definition at line 47 of file midi_event.h.