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

External port. More...

#include <src/engine/device_io/ext_port.h>

Inheritance diagram for zrythm::engine::device_io::ExtPort:
Collaboration diagram for zrythm::engine::device_io::ExtPort:

Public Types

enum class  Type {
  JACK , ALSA , WindowsMME , RtMidi ,
  RtAudio
}
 External port type. More...
 
using PortType = zrythm::dsp::PortType
 
using PortFlow = zrythm::dsp::PortFlow
 
- Public Types inherited from IPortOwner
using TrackUuid = dsp::PortIdentifier::TrackUuid
 
using PluginUuid = dsp::PortIdentifier::PluginUuid
 
using PortUuid = dsp::PortIdentifier::PortUuid
 

Public Member Functions

bool is_in_active_project () const override
 
void set_port_metadata_from_owner (dsp::PortIdentifier &id, PortRange &range) const override
 Function that will be called by the Port to update the identifier's relevant members based on this port owner.
 
utils::Utf8String get_full_designation_for_port (const dsp::PortIdentifier &id) const override
 
void init_loaded (HardwareProcessor *hw_processor)
 Inits the ExtPort after loading a project.
 
void print () const
 Prints the port info.
 
bool matches_backend () const
 Returns if the ext port matches the current backend.
 
utils::Utf8String get_id () const
 Returns a unique identifier (full name prefixed with backend type).
 
utils::Utf8String get_friendly_name () const
 Returns a user-friendly display name (eg, to be used in dropdowns).
 
float * get_buffer (nframes_t nframes) const
 Returns the buffer of the external port.
 
void clear_buffer (nframes_t nframes)
 Clears the buffer of the external port.
 
void disconnect (Port *port, int src)
 Disconnects the Port from the ExtPort.
 
bool activate (Port *port, bool activate)
 Activates the port (starts receiving data) or deactivates it.
 
bool get_enabled () const
 Checks in the GSettings whether this port is marked as enabled by the user.
 
- Public Member Functions inherited from IPortOwner
virtual void on_control_change_event (const PortUuid &port_uuid, const dsp::PortIdentifier &id, float val)
 Will be called when a control port's value changes.
 
virtual void on_midi_activity (const dsp::PortIdentifier &id)
 Called during processing if the MIDI port contains new MIDI events.
 
virtual bool should_sum_data_from_backend () const
 Whether during processing, the port should sum the data from its backend buffers coming in.
 
virtual bool should_bounce_to_master (utils::audio::BounceStep step) const
 Whether the port should add its data to the master output when bouncing.
 
virtual bool are_events_on_midi_channel_approved (midi_byte_t channel) const
 Returns whether MIDI events on this channel on an input port should be processed (not ignored).
 

Data Fields

void * jport_ = nullptr
 JACK port.
 
utils::Utf8String full_name_
 Full port name, used also as ID.
 
utils::Utf8String short_name_
 Short port name.
 
utils::Utf8String alias1_
 Alias #1 if any.
 
utils::Utf8String alias2_
 Alias #2 if any.
 
int num_aliases_ = 0
 
Type type_ = (Type) 0
 
bool is_midi_ = false
 True if MIDI, false if audio.
 
int hw_processor_index_ = -1
 Index in the HW processor (cache for real-time use)
 
HardwareProcessorhw_processor_ = nullptr
 Pointer to owner hardware processor, if any.
 
bool active_ = false
 Whether the port is active and receiving events (for use by hw processor).
 
bool pending_reconnect_ = false
 Set to true when a hardware port is disconnected.
 
Portport_ = nullptr
 Temporary port to receive data.
 

Friends

bool operator== (const ExtPort &a, const ExtPort &b)
 
void to_json (nlohmann::json &j, const ExtPort &port)
 
void from_json (const nlohmann::json &j, ExtPort &port)
 
bool operator== (const ExtPort &a, const ExtPort &b)
 

Detailed Description

External port.

Definition at line 26 of file ext_port.h.

Member Typedef Documentation

◆ PortFlow

using zrythm::engine::device_io::ExtPort::PortFlow = zrythm::dsp::PortFlow

Definition at line 42 of file ext_port.h.

◆ PortType

using zrythm::engine::device_io::ExtPort::PortType = zrythm::dsp::PortType

Definition at line 41 of file ext_port.h.

Member Enumeration Documentation

◆ Type

External port type.

Definition at line 32 of file ext_port.h.

Member Function Documentation

◆ activate()

bool zrythm::engine::device_io::ExtPort::activate ( Port * port,
bool activate )

Activates the port (starts receiving data) or deactivates it.

Parameters
portPort to send the output to.
Returns
Whether successful.

◆ disconnect()

void zrythm::engine::device_io::ExtPort::disconnect ( Port * port,
int src )

Disconnects the Port from the ExtPort.

Parameters
src1 if the ext_port is the source, 0 if it is the destination.

◆ get_enabled()

bool zrythm::engine::device_io::ExtPort::get_enabled ( ) const

Checks in the GSettings whether this port is marked as enabled by the user.

Note
Not realtime safe.
Returns
Whether the port is enabled.

◆ get_full_designation_for_port()

utils::Utf8String zrythm::engine::device_io::ExtPort::get_full_designation_for_port ( const dsp::PortIdentifier & id) const
overridevirtual

Reimplemented from IPortOwner.

◆ init_loaded()

void zrythm::engine::device_io::ExtPort::init_loaded ( HardwareProcessor * hw_processor)
inline

Inits the ExtPort after loading a project.

Definition at line 61 of file ext_port.h.

◆ is_in_active_project()

bool zrythm::engine::device_io::ExtPort::is_in_active_project ( ) const
overridevirtual

Implements IPortOwner.

◆ set_port_metadata_from_owner()

void zrythm::engine::device_io::ExtPort::set_port_metadata_from_owner ( dsp::PortIdentifier & id,
PortRange & range ) const
overridevirtual

Function that will be called by the Port to update the identifier's relevant members based on this port owner.

Parameters
idThe identifier to update.

Implements IPortOwner.

Friends And Related Symbol Documentation

◆ from_json

void from_json ( const nlohmann::json & j,
ExtPort & port )
friend

Definition at line 159 of file ext_port.h.

◆ operator==

bool operator== ( const ExtPort & a,
const ExtPort & b )
friend

Definition at line 170 of file ext_port.h.

◆ to_json

void to_json ( nlohmann::json & j,
const ExtPort & port )
friend

Definition at line 147 of file ext_port.h.

Field Documentation

◆ active_

bool zrythm::engine::device_io::ExtPort::active_ = false

Whether the port is active and receiving events (for use by hw processor).

Definition at line 210 of file ext_port.h.

◆ alias1_

utils::Utf8String zrythm::engine::device_io::ExtPort::alias1_

Alias #1 if any.

Definition at line 190 of file ext_port.h.

◆ alias2_

utils::Utf8String zrythm::engine::device_io::ExtPort::alias2_

Alias #2 if any.

Definition at line 193 of file ext_port.h.

◆ full_name_

utils::Utf8String zrythm::engine::device_io::ExtPort::full_name_

Full port name, used also as ID.

Definition at line 184 of file ext_port.h.

◆ hw_processor_

HardwareProcessor* zrythm::engine::device_io::ExtPort::hw_processor_ = nullptr

Pointer to owner hardware processor, if any.

Definition at line 206 of file ext_port.h.

◆ hw_processor_index_

int zrythm::engine::device_io::ExtPort::hw_processor_index_ = -1

Index in the HW processor (cache for real-time use)

Definition at line 203 of file ext_port.h.

◆ is_midi_

bool zrythm::engine::device_io::ExtPort::is_midi_ = false

True if MIDI, false if audio.

Definition at line 200 of file ext_port.h.

◆ jport_

void* zrythm::engine::device_io::ExtPort::jport_ = nullptr

JACK port.

Definition at line 180 of file ext_port.h.

◆ num_aliases_

int zrythm::engine::device_io::ExtPort::num_aliases_ = 0

Definition at line 195 of file ext_port.h.

◆ pending_reconnect_

bool zrythm::engine::device_io::ExtPort::pending_reconnect_ = false

Set to true when a hardware port is disconnected.

Hardware processor will then attempt to reconnect next scan.

Definition at line 217 of file ext_port.h.

◆ port_

Port* zrythm::engine::device_io::ExtPort::port_ = nullptr

Temporary port to receive data.

Definition at line 222 of file ext_port.h.

◆ short_name_

utils::Utf8String zrythm::engine::device_io::ExtPort::short_name_

Short port name.

Definition at line 187 of file ext_port.h.

◆ type_

Type zrythm::engine::device_io::ExtPort::type_ = (Type) 0

Definition at line 197 of file ext_port.h.


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