Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
|
MIDI port specifics. More...
#include <src/gui/dsp/midi_port.h>
Public Member Functions | |
MidiPort (utils::Utf8String label, PortFlow flow) | |
void | process_block (EngineProcessTimeInfo time_nfo) override |
void | prepare_for_processing (sample_rate_t sample_rate, nframes_t max_block_length) override |
Called to allocate resources required for processing. | |
void | release_resources () override |
Called to release resources allocated by prepare_for_processing(). | |
void | clear_buffer (std::size_t block_length) override |
Clears the port buffer. | |
Public Member Functions inherited from Port | |
void | init_loaded (IPortOwner &owner) |
This function finds the Ports corresponding to the PortIdentifiers for srcs and dests. | |
void | set_owner (IPortOwner &owner) |
utils::Utf8String | get_label () const |
bool | is_control () const |
bool | is_audio () const |
bool | is_cv () const |
bool | is_event () const |
bool | is_midi () const |
bool | is_input () const |
bool | is_output () const |
utils::Utf8String | get_node_name () const override |
Returns a human friendly name of the node. | |
nframes_t | get_single_playback_latency () const override |
Ports have no latency. | |
virtual bool | has_sound () const |
If MIDI port, returns if there are any events, if audio port, returns if there is sound in the buffer. | |
utils::Utf8String | get_full_designation () const |
Gets a full designation of the port in the format "Track/Port" or "Track/Plugin/Port". | |
void | change_track (IPortOwner::TrackUuid new_track_id) |
Updates the owner track identifier. | |
bool | has_label () const |
PortType | get_type () const |
PortFlow | get_flow () const |
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< Port > | |
UuidIdentifiableObject & | operator= (const UuidIdentifiableObject &other)=default |
auto | get_uuid () const |
Data Fields | |
dsp::MidiEvents | midi_events_ |
Contains raw MIDI data (MIDI ports only) | |
std::unique_ptr< RingBuffer< dsp::MidiEvent > > | midi_ring_ |
Ring buffer for saving MIDI events to be used in the UI instead of directly accessing the events. | |
std::atomic< bool > | has_midi_events_ = false |
Whether the port has midi events not yet processed by the UI. | |
qint64 | last_midi_event_time_ = 0 |
Used by the UI to detect when unprocessed MIDI events exist. | |
midi_byte_t | last_midi_status_ = 0 |
Last known MIDI status byte received. | |
Data Fields inherited from Port | |
std::unique_ptr< PortIdentifier > | id_ |
Owned pointer. | |
IPortOwner * | owner_ {} |
PortRange | range_ |
Data Fields inherited from PortConnectionsCacheMixin< MidiPort > | |
std::vector< ElementType > | port_sources_ |
Caches filled when recalculating the graph. | |
Data Fields inherited from RingBufferOwningPortMixin | |
std::atomic< int > | num_ring_buffer_readers_ { 0 } |
Number of entities that want ring buffers to be written. |
Friends | |
void | init_from (MidiPort &obj, const MidiPort &other, utils::ObjectCloneType clone_type) |
void | to_json (nlohmann::json &j, const MidiPort &p) |
void | from_json (const nlohmann::json &j, MidiPort &p) |
Additional Inherited Members | |
Public Types inherited from Port | |
using | PortIdentifier = dsp::PortIdentifier |
using | PortType = dsp::PortType |
using | PortFlow = dsp::PortFlow |
using | PortConnection = dsp::PortConnection |
Protected Member Functions inherited from Port | |
Port (utils::Utf8String label, PortType type={}, PortFlow flow={}, float minf=0.f, float maxf=1.f, float zerof=0.f) |
MIDI port specifics.
Definition at line 19 of file midi_port.h.
|
overridevirtual |
Clears the port buffer.
Implements Port.
|
overridevirtual |
Called to allocate resources required for processing.
sample_rate | |
max_block_length |
Reimplemented from zrythm::dsp::graph::IProcessable.
|
overridevirtual |
Reimplemented from zrythm::dsp::graph::IProcessable.
|
overridevirtual |
Called to release resources allocated by prepare_for_processing().
This may be called multiple times.
Reimplemented from zrythm::dsp::graph::IProcessable.
|
friend |
Definition at line 53 of file midi_port.h.
|
friend |
Definition at line 49 of file midi_port.h.
std::atomic<bool> MidiPort::has_midi_events_ = false |
Whether the port has midi events not yet processed by the UI.
Definition at line 79 of file midi_port.h.
qint64 MidiPort::last_midi_event_time_ = 0 |
Used by the UI to detect when unprocessed MIDI events exist.
Definition at line 82 of file midi_port.h.
midi_byte_t MidiPort::last_midi_status_ = 0 |
Last known MIDI status byte received.
Used for running status (see http://midi.teragonaudio.com/tech/midispec/run.htm).
Not needed for JACK.
Definition at line 92 of file midi_port.h.
dsp::MidiEvents MidiPort::midi_events_ |
Contains raw MIDI data (MIDI ports only)
Definition at line 62 of file midi_port.h.
std::unique_ptr<RingBuffer<dsp::MidiEvent> > MidiPort::midi_ring_ |
Ring buffer for saving MIDI events to be used in the UI instead of directly accessing the events.
This should keep pushing MidiEvent's whenever they occur and the reader should empty it after checking if there are any events.
Currently there is only 1 reader for each port so this wont be a problem for now, but we should have one ring for each reader.
Definition at line 74 of file midi_port.h.