Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
PortIdentifier Struct Reference

Struct used to identify Ports in the project. More...

#include <dsp/port_identifier.h>

Collaboration diagram for PortIdentifier:

Public Types

enum class  OwnerType {
  PORT_OWNER_TYPE_AUDIO_ENGINE , PLUGIN , TRACK , CHANNEL ,
  FADER , CHANNEL_SEND , TRACK_PROCESSOR , HW ,
  PORT_OWNER_TYPE_TRANSPORT , MODULATOR_MACRO_PROCESSOR
}
 Type of owner. More...
 
enum class  Flags {
  STEREO_L = 1 << 0 , STEREO_R = 1 << 1 , PianoRoll = 1 << 2 , SIDECHAIN = 1 << 3 ,
  MAIN_PORT = 1 << 4 , MANUAL_PRESS = 1 << 5 , AMPLITUDE = 1 << 6 , STEREO_BALANCE = 1 << 7 ,
  WANT_POSITION = 1 << 8 , TRIGGER = 1 << 9 , TOGGLE = 1 << 10 , INTEGER = 1 << 11 ,
  FREEWHEEL = 1 << 12 , REPORTS_LATENCY = 1 << 13 , NOT_ON_GUI = 1 << 14 , PLUGIN_ENABLED = 1 << 15 ,
  PLUGIN_CONTROL = 1 << 16 , FADER_MUTE = 1 << 17 , CHANNEL_FADER = 1 << 18 , AUTOMATABLE = 1 << 19 ,
  MIDI_AUTOMATABLE = 1 << 20 , SEND_RECEIVABLE = 1 << 21 , BPM = 1 << 22 , GENERIC_PLUGIN_PORT = 1 << 23 ,
  PLUGIN_GAIN = 1 << 24 , TP_MONO = 1 << 25 , TP_INPUT_GAIN = 1 << 26 , HW = 1 << 27 ,
  MODULATOR_MACRO = 1 << 28 , LOGARITHMIC = 1 << 29 , IS_PROPERTY = 1 << 30
}
 Port flags. More...
 
enum class  Flags2 {
  TRANSPORT_ROLL = 1 << 0 , TRANSPORT_STOP = 1 << 1 , TRANSPORT_BACKWARD = 1 << 2 , TRANSPORT_FORWARD = 1 << 3 ,
  TRANSPORT_LOOP_TOGGLE = 1 << 4 , TRANSPORT_REC_TOGGLE = 1 << 5 , SUPPORTS_PATCH_MESSAGE = 1 << 6 , ENUMERATION = 1 << 7 ,
  URI_PARAM = 1 << 8 , SEQUENCE = 1 << 9 , SUPPORTS_MIDI = 1 << 10 , TP_OUTPUT_GAIN = 1 << 11 ,
  MIDI_PITCH_BEND = 1 << 12 , MIDI_POLY_KEY_PRESSURE = 1 << 13 , MIDI_CHANNEL_PRESSURE = 1 << 14 , CHANNEL_SEND_ENABLED = 1 << 15 ,
  CHANNEL_SEND_AMOUNT = 1 << 16 , BEATS_PER_BAR = 1 << 17 , BEAT_UNIT = 1 << 18 , FADER_SOLO = 1 << 19 ,
  FADER_LISTEN = 1 << 20 , FADER_MONO_COMPAT = 1 << 21 , TRACK_RECORDING = 1 << 22 , TP_MONITOR_AUDIO = 1 << 23 ,
  PREFADER = 1 << 24 , POSTFADER = 1 << 25 , MonitorFader = 1 << 26 , SAMPLE_PROCESSOR_FADER = 1 << 27 ,
  SAMPLE_PROCESSOR_TRACK = 1 << 28 , FADER_SWAP_PHASE = 1 << 29 , MIDI_CLOCK = 1 << 30
}
 

Public Member Functions

 PortIdentifier (const PortIdentifier &other)
 
PortIdentifieroperator= (const PortIdentifier &other)
 
void init ()
 
const char * get_label () const
 
int get_midi_channel () const
 Returns the MIDI channel for a MIDI CC port, or -1 if not a MIDI CC port.
 
WARN_UNUSED_RESULT bool is_equal (const PortIdentifier &other) const
 Returns if the 2 PortIdentifier's are equal.
 
NONNULL void print_to_str (char *buf, size_t buf_sz) const
 
void print () const
 
bool validate () const
 
uint32_t get_hash () const
 

Data Fields

int schema_version = PORT_IDENTIFIER_SCHEMA_VERSION
 
char * label = nullptr
 Human readable label.
 
char * sym = nullptr
 Unique symbol.
 
char * uri = nullptr
 URI, if LV2 property.
 
char * comment = nullptr
 Comment, if any.
 
PortIdentifier::OwnerType owner_type = (OwnerType) 0
 Owner type.
 
ZPortType type = (ZPortType) 0
 Data type (e.g.
 
ZPortFlow flow = (ZPortFlow) 0
 Flow (IN/OUT).
 
PortIdentifier::Flags flags = (Flags) 0
 Flags (e.g.
 
PortIdentifier::Flags2 flags2 = (Flags2) 0
 
PortUnit unit = (PortUnit) 0
 Port unit.
 
PluginIdentifier plugin_id = {}
 Identifier of plugin.
 
char * port_group = nullptr
 Port group this port is part of (only applicable for LV2 plugin ports).
 
char * ext_port_id = nullptr
 ExtPort ID (type + full name), if hw port.
 
unsigned int track_name_hash = 0
 Track name hash (0 for non-track ports).
 
int port_index = 0
 Index (e.g.
 

Detailed Description

Struct used to identify Ports in the project.

This should include some members of the original struct enough to identify the port. To be used for sources and dests.

This must be filled in before saving and read from while loading to fill in the srcs/dests.

Definition at line 89 of file port_identifier.h.

Member Enumeration Documentation

◆ Flags

enum class PortIdentifier::Flags
strong

Port flags.

Enumerator
SIDECHAIN 

See http://lv2plug.in/ns/ext/port-groups/port-groups.html#sideChainOf.

MAIN_PORT 

See http://lv2plug.in/ns/ext/port-groups/port-groups.html#mainInput and http://lv2plug.in/ns/ext/port-groups/port-groups.html#mainOutput.

AMPLITUDE 

Amplitude port.

STEREO_BALANCE 

Port controls the stereo balance.

This is used in channels for the balance control.

WANT_POSITION 

Whether the port wants to receive position events.

This is only applicable for LV2 Atom ports.

TRIGGER 

Trigger ports will be set to 0 at the end of each cycle.

This mostly applies to LV2 Control Input ports.

TOGGLE 

Whether the port is a toggle (on/off).

INTEGER 

Whether the port is an integer.

FREEWHEEL 

Whether port is for letting the plugin know that we are in freewheeling (export) mode.

REPORTS_LATENCY 

Used for plugin ports.

NOT_ON_GUI 

Port should not be visible to users.

PLUGIN_ENABLED 

Port is a switch for plugin enabled.

PLUGIN_CONTROL 

Port is a plugin control.

FADER_MUTE 

Port is for fader mute.

CHANNEL_FADER 

Port is for channel fader.

AUTOMATABLE 

Port has an automation track.

If this is set, it is assumed that the automation track at PortIdentifier::port_index is for this port.

MIDI_AUTOMATABLE 

MIDI automatable control, such as modwheel or pitch bend.

SEND_RECEIVABLE 

Channels can send to this port (ie, this port is a track processor midi/stereo in or a plugin sidechain in).

BPM 

This is a BPM port.

GENERIC_PLUGIN_PORT 

Generic plugin port not belonging to the underlying plugin.

This is for ports that are added by Zrythm such as Enabled and Gain.

PLUGIN_GAIN 

This is the plugin gain.

TP_MONO 

Track processor input mono switch.

TP_INPUT_GAIN 

Track processor input gain.

HW 

Port is a hardware port.

MODULATOR_MACRO 

Port is part of a modulator macro processor.

Which of the ports it is can be determined by checking flow/type.

LOGARITHMIC 

Logarithmic.

IS_PROPERTY 

Plugin control is a property (changes are set via atom message on the plugin's control port), as opposed to conventional float control ports.

An input Port is created for each parameter declared as either writable or readable (or both).

See also
http://lv2plug.in/ns/lv2core#Parameter.

Definition at line 135 of file port_identifier.h.

◆ Flags2

enum class PortIdentifier::Flags2
strong
Enumerator
TRANSPORT_ROLL 

Transport ports.

SUPPORTS_PATCH_MESSAGE 

LV2 control atom port supports patch messages.

ENUMERATION 

Port's only reasonable values are its scale points.

URI_PARAM 

Parameter port's value type is URI.

SEQUENCE 

Atom port buffer type is sequence.

SUPPORTS_MIDI 

Atom or event port supports MIDI.

TP_OUTPUT_GAIN 

Track processor output gain.

MIDI_PITCH_BEND 

MIDI pitch bend.

MIDI_POLY_KEY_PRESSURE 

MIDI poly key pressure.

MIDI_CHANNEL_PRESSURE 

MIDI channel pressure.

CHANNEL_SEND_ENABLED 

Channel send enabled.

CHANNEL_SEND_AMOUNT 

Channel send amount.

BEATS_PER_BAR 

Beats per bar.

BEAT_UNIT 

Beat unit.

FADER_SOLO 

Fader solo.

FADER_LISTEN 

Fader listen.

FADER_MONO_COMPAT 

Fader mono compat.

TRACK_RECORDING 

Track recording.

TP_MONITOR_AUDIO 

Track processor monitor audio.

PREFADER 

Port is owned by prefader.

POSTFADER 

Port is owned by postfader.

MonitorFader 

Port is owned by monitor fader.

SAMPLE_PROCESSOR_FADER 

Port is owned by the sample processor fader.

SAMPLE_PROCESSOR_TRACK 

Port is owned by sample processor track/channel (including faders owned by those tracks/channels).

FADER_SWAP_PHASE 

Fader swap phase.

MIDI_CLOCK 

MIDI clock.

Definition at line 268 of file port_identifier.h.

◆ OwnerType

enum class PortIdentifier::OwnerType
strong

Type of owner.

Enumerator
PLUGIN 

Plugin owner.

TRACK 

Track owner.

CHANNEL 

Channel owner.

FADER 

Fader.

CHANNEL_SEND 

Channel send.

PortIdentifier.port_index will contain the send index on the port's track's channel.

HW 

Port is part of a HardwareProcessor.

PORT_OWNER_TYPE_TRANSPORT 

Port is owned by engine transport.

MODULATOR_MACRO_PROCESSOR 

Modulator macro processor owner.

Definition at line 94 of file port_identifier.h.

Member Function Documentation

◆ get_label()

const char * PortIdentifier::get_label ( ) const
inline

Definition at line 409 of file port_identifier.h.

◆ get_midi_channel()

int PortIdentifier::get_midi_channel ( ) const
inline

Returns the MIDI channel for a MIDI CC port, or -1 if not a MIDI CC port.

Note
MIDI channels start from 1 (not 0).

Definition at line 416 of file port_identifier.h.

◆ is_equal()

WARN_UNUSED_RESULT bool PortIdentifier::is_equal ( const PortIdentifier & other) const

Returns if the 2 PortIdentifier's are equal.

Note
Does not check insignificant data like comment.

Field Documentation

◆ comment

char* PortIdentifier::comment = nullptr

Comment, if any.

Definition at line 370 of file port_identifier.h.

◆ ext_port_id

char* PortIdentifier::ext_port_id = nullptr

ExtPort ID (type + full name), if hw port.

Definition at line 392 of file port_identifier.h.

◆ flags

PortIdentifier::Flags PortIdentifier::flags = (Flags) 0

Flags (e.g.

is side chain).

Definition at line 379 of file port_identifier.h.

◆ flags2

PortIdentifier::Flags2 PortIdentifier::flags2 = (Flags2) 0

Definition at line 380 of file port_identifier.h.

◆ flow

ZPortFlow PortIdentifier::flow = (ZPortFlow) 0

Flow (IN/OUT).

Definition at line 377 of file port_identifier.h.

◆ label

char* PortIdentifier::label = nullptr

Human readable label.

Definition at line 361 of file port_identifier.h.

◆ owner_type

PortIdentifier::OwnerType PortIdentifier::owner_type = (OwnerType) 0

Owner type.

Definition at line 373 of file port_identifier.h.

◆ plugin_id

PluginIdentifier PortIdentifier::plugin_id = {}

Identifier of plugin.

Definition at line 386 of file port_identifier.h.

◆ port_group

char* PortIdentifier::port_group = nullptr

Port group this port is part of (only applicable for LV2 plugin ports).

Definition at line 389 of file port_identifier.h.

◆ port_index

int PortIdentifier::port_index = 0

Index (e.g.

in plugin's output ports).

Definition at line 398 of file port_identifier.h.

◆ schema_version

int PortIdentifier::schema_version = PORT_IDENTIFIER_SCHEMA_VERSION

Definition at line 358 of file port_identifier.h.

◆ sym

char* PortIdentifier::sym = nullptr

Unique symbol.

Definition at line 364 of file port_identifier.h.

◆ track_name_hash

unsigned int PortIdentifier::track_name_hash = 0

Track name hash (0 for non-track ports).

Definition at line 395 of file port_identifier.h.

◆ type

ZPortType PortIdentifier::type = (ZPortType) 0

Data type (e.g.

AUDIO).

Definition at line 375 of file port_identifier.h.

◆ unit

PortUnit PortIdentifier::unit = (PortUnit) 0

Port unit.

Definition at line 383 of file port_identifier.h.

◆ uri

char* PortIdentifier::uri = nullptr

URI, if LV2 property.

Definition at line 367 of file port_identifier.h.


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