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

External port. More...

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

Inheritance diagram for ExtPort:
Collaboration diagram for 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).
 

Static Public Member Functions

static void ext_ports_get (PortType type, PortFlow flow, bool hw, std::vector< ExtPort > &ports, AudioEngine &engine)
 Collects external ports of the given type.
 

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 35 of file ext_port.h.

Member Typedef Documentation

◆ PortFlow

using ExtPort::PortFlow = zrythm::dsp::PortFlow

Definition at line 51 of file ext_port.h.

◆ PortType

using ExtPort::PortType = zrythm::dsp::PortType

Definition at line 50 of file ext_port.h.

Member Enumeration Documentation

◆ Type

enum class ExtPort::Type
strong

External port type.

Definition at line 41 of file ext_port.h.

Member Function Documentation

◆ activate()

bool 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 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.

◆ ext_ports_get()

static void ExtPort::ext_ports_get ( PortType type,
PortFlow flow,
bool hw,
std::vector< ExtPort > & ports,
AudioEngine & engine )
static

Collects external ports of the given type.

Parameters
flowThe signal flow. Note that this is inverse to what Zrythm sees. E.g., to get MIDI inputs like MIDI keyboards, pass Z_PORT_FLOW_OUTPUT here.
hwHardware or not.

◆ get_enabled()

bool 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 ExtPort::get_full_designation_for_port ( const dsp::PortIdentifier & id) const
overridevirtual

Reimplemented from IPortOwner.

◆ init_loaded()

void ExtPort::init_loaded ( HardwareProcessor * hw_processor)
inline

Inits the ExtPort after loading a project.

Definition at line 70 of file ext_port.h.

◆ is_in_active_project()

bool ExtPort::is_in_active_project ( ) const
overridevirtual

Implements IPortOwner.

◆ set_port_metadata_from_owner()

void 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 183 of file ext_port.h.

◆ operator==

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

Definition at line 194 of file ext_port.h.

◆ to_json

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

Definition at line 171 of file ext_port.h.

Field Documentation

◆ active_

bool ExtPort::active_ = false

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

Definition at line 234 of file ext_port.h.

◆ alias1_

utils::Utf8String ExtPort::alias1_

Alias #1 if any.

Definition at line 214 of file ext_port.h.

◆ alias2_

utils::Utf8String ExtPort::alias2_

Alias #2 if any.

Definition at line 217 of file ext_port.h.

◆ full_name_

utils::Utf8String ExtPort::full_name_

Full port name, used also as ID.

Definition at line 208 of file ext_port.h.

◆ hw_processor_

HardwareProcessor* ExtPort::hw_processor_ = nullptr

Pointer to owner hardware processor, if any.

Definition at line 230 of file ext_port.h.

◆ hw_processor_index_

int ExtPort::hw_processor_index_ = -1

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

Definition at line 227 of file ext_port.h.

◆ is_midi_

bool ExtPort::is_midi_ = false

True if MIDI, false if audio.

Definition at line 224 of file ext_port.h.

◆ jport_

void* ExtPort::jport_ = nullptr

JACK port.

Definition at line 204 of file ext_port.h.

◆ num_aliases_

int ExtPort::num_aliases_ = 0

Definition at line 219 of file ext_port.h.

◆ pending_reconnect_

bool 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 241 of file ext_port.h.

◆ port_

Port* ExtPort::port_ = nullptr

Temporary port to receive data.

Definition at line 246 of file ext_port.h.

◆ short_name_

utils::Utf8String ExtPort::short_name_

Short port name.

Definition at line 211 of file ext_port.h.

◆ type_

Type ExtPort::type_ = (Type) 0

Definition at line 221 of file ext_port.h.


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