Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
Port Class Referenceabstract

The Port class represents a port in the audio processing graph. More...

#include <src/gui/dsp/port.h>

Inheritance diagram for Port:
Collaboration diagram for Port:

Public Types

using PortIdentifier = dsp::PortIdentifier
 
using PortType = dsp::PortType
 
using PortFlow = dsp::PortFlow
 
using PortConnection = dsp::PortConnection
 

Public Member Functions

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 void clear_buffer (std::size_t block_length)=0
 Clears the port buffer.
 
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::dsp::graph::IProcessable
virtual void prepare_for_processing (sample_rate_t sample_rate, nframes_t max_block_length)
 Called to allocate resources required for processing.
 
virtual void process_block (EngineProcessTimeInfo time_nfo)
 
virtual void release_resources ()
 Called to release resources allocated by prepare_for_processing().
 
- Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< Port >
 UuidIdentifiableObject (const Uuid &id)
 
 UuidIdentifiableObject (const UuidIdentifiableObject &other)=default
 
 UuidIdentifiableObject (UuidIdentifiableObject &&other)=default
 
UuidIdentifiableObjectoperator= (const UuidIdentifiableObject &other)=default
 
UuidIdentifiableObjectoperator= (UuidIdentifiableObject &&other)=default
 
auto get_uuid () const
 

Data Fields

std::unique_ptr< PortIdentifierid_
 Owned pointer.
 
IPortOwnerowner_ {}
 
PortRange range_
 

Protected Member Functions

 Port (utils::Utf8String label, PortType type={}, PortFlow flow={}, float minf=0.f, float maxf=1.f, float zerof=0.f)
 

Friends

void init_from (Port &obj, const Port &other, utils::ObjectCloneType clone_type)
 
void to_json (nlohmann::json &j, const Port &p)
 
void from_json (const nlohmann::json &j, Port &p)
 

Detailed Description

The Port class represents a port in the audio processing graph.

Ports can be of different types (audio, MIDI, CV, control) and can be inputs or outputs. They are used to connect different components of the audio processing graph, such as tracks, plugins, and the audio engine.

Ports are owned by various components in the audio processing graph, such as tracks, plugins, and the audio engine. The set_owner() method is used to set the owner of the port.

Definition at line 166 of file port.h.

Member Typedef Documentation

◆ PortConnection

Definition at line 175 of file port.h.

◆ PortFlow

using Port::PortFlow = dsp::PortFlow

Definition at line 174 of file port.h.

◆ PortIdentifier

Definition at line 172 of file port.h.

◆ PortType

using Port::PortType = dsp::PortType

Definition at line 173 of file port.h.

Member Function Documentation

◆ clear_buffer()

virtual void Port::clear_buffer ( std::size_t block_length)
pure virtual

Clears the port buffer.

Implemented in AudioPort, ControlPort, CVPort, and MidiPort.

◆ get_flow()

PortFlow Port::get_flow ( ) const
inline

Definition at line 238 of file port.h.

◆ get_full_designation()

utils::Utf8String Port::get_full_designation ( ) const
inline

Gets a full designation of the port in the format "Track/Port" or "Track/Plugin/Port".

Definition at line 224 of file port.h.

◆ get_node_name()

utils::Utf8String Port::get_node_name ( ) const
inlineoverridevirtual

Returns a human friendly name of the node.

Implements zrythm::dsp::graph::IProcessable.

Definition at line 199 of file port.h.

◆ get_single_playback_latency()

nframes_t Port::get_single_playback_latency ( ) const
inlineoverridevirtual

Ports have no latency.

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

Definition at line 207 of file port.h.

◆ get_type()

PortType Port::get_type ( ) const
inline

Definition at line 237 of file port.h.

◆ has_label()

bool Port::has_label ( ) const
inline

Definition at line 236 of file port.h.

◆ has_sound()

virtual bool Port::has_sound ( ) const
inlinevirtual

If MIDI port, returns if there are any events, if audio port, returns if there is sound in the buffer.

Reimplemented in AudioPort, and CVPort.

Definition at line 218 of file port.h.

◆ init_loaded()

void Port::init_loaded ( IPortOwner & owner)
inline

This function finds the Ports corresponding to the PortIdentifiers for srcs and dests.

Should be called after the ports are deserialized from JSON.

Definition at line 185 of file port.h.

◆ is_audio()

bool Port::is_audio ( ) const
inline

Definition at line 192 of file port.h.

◆ is_control()

bool Port::is_control ( ) const
inline

Definition at line 191 of file port.h.

◆ is_cv()

bool Port::is_cv ( ) const
inline

Definition at line 193 of file port.h.

◆ is_event()

bool Port::is_event ( ) const
inline

Definition at line 194 of file port.h.

◆ is_input()

bool Port::is_input ( ) const
inline

Definition at line 196 of file port.h.

◆ is_midi()

bool Port::is_midi ( ) const
inline

Definition at line 195 of file port.h.

◆ is_output()

bool Port::is_output ( ) const
inline

Definition at line 197 of file port.h.

Friends And Related Symbol Documentation

◆ from_json

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

Definition at line 257 of file port.h.

◆ to_json

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

Definition at line 256 of file port.h.

Field Documentation

◆ id_

std::unique_ptr<PortIdentifier> Port::id_

Owned pointer.

Definition at line 266 of file port.h.

◆ owner_

IPortOwner* Port::owner_ {}

Definition at line 269 of file port.h.

◆ range_

PortRange Port::range_

Definition at line 270 of file port.h.


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