Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::MidiPort Class Referencefinal

MIDI port specifics. More...

#include <src/dsp/midi_port.h>

Inheritance diagram for zrythm::dsp::MidiPort:
Collaboration diagram for zrythm::dsp::MidiPort:

Public Member Functions

 MidiPort (utils::Utf8String label, PortFlow flow)
void process_block (EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport) noexcept override
void prepare_for_processing (const graph::GraphNode *node, units::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 offset, std::size_t nframes) override
 Clears the port buffer.
Public Member Functions inherited from zrythm::dsp::Port
void set_full_designation_provider (FullDesignationProvider provider)
void set_full_designation_provider (const auto *owner)
 Convenience helper for providers that contain a get_full_designation_for_port() method.
bool is_input () const
bool is_output () const
bool is_midi () const
bool is_cv () const
bool is_audio () const
utils::Utf8String get_label () const
auto get_symbol () const
void set_symbol (const utils::Utf8String &sym)
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.
utils::Utf8String get_full_designation () const
 Gets a full designation of the port in the format "Track/Port" or "Track/Plugin/Port".
bool has_label () const
PortType type () const
PortFlow flow () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< Port >
UuidIdentifiableObject & operator= (const UuidIdentifiableObject &other)=default
auto get_uuid () const
Public Member Functions inherited from zrythm::dsp::PortConnectionsCacheMixin< MidiPort >
auto & port_sources () const
void set_port_sources (this auto &self, RangeOf< MidiPort * > auto source_ports)

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.
Data Fields inherited from zrythm::dsp::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 zrythm::dsp::Port
using FullDesignationProvider
Protected Member Functions inherited from zrythm::dsp::Port
 Port (utils::Utf8String label, PortType type={}, PortFlow flow={})

Detailed Description

MIDI port specifics.

Definition at line 17 of file midi_port.h.

Member Function Documentation

◆ clear_buffer()

void zrythm::dsp::MidiPort::clear_buffer ( std::size_t offset,
std::size_t nframes )
overridevirtual

Clears the port buffer.

Implements zrythm::dsp::Port.

◆ prepare_for_processing()

void zrythm::dsp::MidiPort::prepare_for_processing ( const graph::GraphNode * node,
units::sample_rate_t sample_rate,
nframes_t max_block_length )
overridevirtual

Called to allocate resources required for processing.

Parameters
nodeThe node in the processing graph. Null means we are processing outside of a graph context and must be handled gracefully.
sample_rate
max_block_length

Reimplemented from zrythm::dsp::graph::IProcessable.

◆ process_block()

void zrythm::dsp::MidiPort::process_block ( EngineProcessTimeInfo time_nfo,
const dsp::ITransport & transport )
overridevirtualnoexcept

Reimplemented from zrythm::dsp::graph::IProcessable.

◆ release_resources()

void zrythm::dsp::MidiPort::release_resources ( )
overridevirtual

Called to release resources allocated by prepare_for_processing().

This may be called multiple times.

Reimplemented from zrythm::dsp::graph::IProcessable.

◆ from_json

void from_json ( const nlohmann::json & j,
MidiPort & p )
friend

Definition at line 53 of file midi_port.h.

◆ to_json

void to_json ( nlohmann::json & j,
const MidiPort & p )
friend

Definition at line 49 of file midi_port.h.

Field Documentation

◆ midi_events_

dsp::MidiEvents zrythm::dsp::MidiPort::midi_events_

Contains raw MIDI data (MIDI ports only).

Definition at line 62 of file midi_port.h.

◆ midi_ring_

std::unique_ptr<RingBuffer<dsp::MidiEvent> > zrythm::dsp::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.


The documentation for this class was generated from the following file: