4#ifndef ZRYTHM_DSP_PORT_IDENTIFIER_H
5#define ZRYTHM_DSP_PORT_IDENTIFIER_H
7#include "zrythm-config.h"
9#include "utils/icloneable.h"
11#include "utils/uuid_identifiable_object.h"
14namespace zrythm::gui::old_dsp::plugins
260 TransportStop = 1 << 1,
261 TransportBackward = 1 << 2,
262 TransportForward = 1 << 3,
263 TransportLoopToggle = 1 << 4,
264 TransportRecToggle = 1 << 5,
351 bool is_control ()
const {
return type_ == PortType::Control; }
352 bool is_midi ()
const {
return type_ == PortType::Event; }
353 bool is_cv ()
const {
return type_ == PortType::CV; }
354 bool is_audio ()
const {
return type_ == PortType::Audio; }
356 bool is_input ()
const {
return flow_ == PortFlow::Input; }
357 bool is_output ()
const {
return flow_ == PortFlow::Output; }
359 bool is_monitor_fader_stereo_in_or_out_port ()
const
362 && (ENUM_BITSET_TEST (
flags_, Flags::StereoL) || ENUM_BITSET_TEST (
flags_, Flags::StereoR));
365 auto get_track_id ()
const {
return track_id_; }
366 void set_track_id (TrackUuid track_id) {
track_id_ = track_id; }
367 auto get_plugin_id ()
const {
return plugin_id_; }
368 void set_plugin_id (PluginUuid plugin_id) {
plugin_id_ = plugin_id; }
369 auto get_symbol ()
const {
return sym_; }
371 std::string print_to_str ()
const;
373 bool validate ()
const;
374 size_t get_hash ()
const;
376 static utils::Utf8String port_unit_to_string (PortUnit unit);
379 init_after_cloning (
const PortIdentifier &other,
ObjectCloneType clone_type)
396 PortType
type_{ PortType::Unknown };
398 PortFlow
flow_{ PortFlow::Unknown };
417 std::optional<utils::Utf8String>
uri_;
431 friend void to_json (nlohmann::json &j,
const PortIdentifier &port)
435 {
"symbol", port.
sym_ },
436 {
"uri", port.
uri_ },
439 {
"type", port.
type_ },
440 {
"flow", port.
flow_ },
441 {
"unit", port.
unit_ },
443 {
"flags2", port.flags2_ },
452 friend void from_json (
const nlohmann::json &j,
PortIdentifier &port)
454 j.at (
"label").get_to (port.
label_);
455 j.at (
"symbol").get_to (port.
sym_);
456 j.at (
"uri").get_to (port.
uri_);
457 j.at (
"comment").get_to (port.
comment_);
459 j.at (
"type").get_to (port.
type_);
460 j.at (
"flow").get_to (port.
flow_);
461 j.at (
"unit").get_to (port.
unit_);
462 j.at (
"flags").get_to (port.
flags_);
463 j.at (
"flags2").get_to (port.flags2_);
464 j.at (
"trackId").get_to (port.
track_id_);
The Port class represents a port in the audio processing graph.
Represents a track in the project.
Struct used to identify Ports in the project.
PortType type_
Data type (e.g.
PortIdentifier::Flags flags_
Flags (e.g.
std::optional< utils::Utf8String > uri_
URI, if LV2 property.
std::optional< utils::Utf8String > comment_
Comment, if any.
std::optional< PluginUuid > plugin_id_
Identifier of plugin.
@ Plugin
zrythm::gui::old_dsp::plugins::Plugin owner.
@ ModulatorMacroProcessor
Modulator macro processor owner.
@ ChannelSend
Channel send.
@ HardwareProcessor
Port is part of a HardwareProcessor.
@ Transport
Port is owned by engine transport.
utils::Utf8String label_
Human readable label.
PortFlow flow_
Flow (IN/OUT).
@ Automatable
Port has an automation track.
@ Logarithmic
Logarithmic.
@ ModulatorMacro
Port is part of a modulator macro processor.
@ SendReceivable
Channels can send to this port (ie, this port is a track processor midi/stereo in or a plugin sidecha...
@ FaderMute
Port is for fader mute.
@ StereoBalance
Port controls the stereo balance.
@ MidiAutomatable
MIDI automatable control, such as modwheel or pitch bend.
@ IsProperty
zrythm::gui::old_dsp::plugins::Plugin control is a property (changes are set via atom message on the ...
@ WantPosition
Whether the port wants to receive position events.
@ ChannelFader
Port is for channel fader.
@ ReportsLatency
Used for plugin ports.
@ TpInputGain
Track processor input gain.
@ Hw
Port is a hardware port.
@ ManualPress
Piano roll user (piano) key press.
@ Integer
Whether the port is an integer.
@ Toggle
Whether the port is a toggle (on/off).
@ PluginGain
This is the plugin gain.
@ Freewheel
Whether port is for letting the plugin know that we are in freewheeling (export) mode.
@ Sidechain
See http://lv2plug.in/ns/ext/port-groups/port-groups.html#sideChainOf.
@ MainPort
See http://lv2plug.in/ns/ext/port-groups/port-groups.html#mainInput and http://lv2plug....
@ PluginControl
Port is a plugin control.
@ NotOnGui
Port should not be visible to users.
@ GenericPluginPort
Generic plugin port not belonging to the underlying plugin.
@ PluginEnabled
Port is a switch for plugin enabled.
@ Amplitude
Amplitude port.
@ Trigger
Trigger ports will be set to 0 at the end of each cycle.
@ TpMono
Track processor input mono switch.
std::optional< midi_byte_t > midi_channel_
MIDI channel if MIDI CC port, starting from 1 (so [1, 16]).
std::optional< utils::Utf8String > port_group_
Port group this port is part of (only applicable for LV2 plugin ports).
std::optional< utils::Utf8String > ext_port_id_
ExtPort ID (type + full name), if hw port.
@ MidiChannelPressure
MIDI channel pressure.
@ ChannelSendEnabled
Channel send enabled.
@ FaderListen
Fader listen.
@ SampleProcessorTrack
Port is owned by sample processor track/channel (including faders owned by those tracks/channels).
@ Prefader
Port is owned by prefader.
@ BeatsPerBar
Beats per bar.
@ MonitorFader
Port is owned by monitor fader.
@ Enumeration
Port's only reasonable values are its scale points.
@ SampleProcessorFader
Port is owned by the sample processor fader.
@ TrackRecording
Track recording.
@ SupportsPatchMessage
LV2 control atom port supports patch messages.
@ UriParam
Parameter port's value type is URI.
@ Sequence
Atom port buffer type is sequence.
@ FaderSwapPhase
Fader swap phase.
@ FaderMonoCompat
Fader mono compat.
@ ChannelSendAmount
Channel send amount.
@ TpMonitorAudio
Track processor monitor audio.
@ TransportRoll
Transport ports.
@ SupportsMidi
Atom or event port supports MIDI.
@ MidiPolyKeyPressure
MIDI poly key pressure.
@ Postfader
Port is owned by postfader.
@ TpOutputGain
Track processor output gain.
@ MidiPitchBend
MIDI pitch bend.
utils::Utf8String sym_
Unique symbol.
std::optional< TrackUuid > track_id_
Track identifier.
size_t port_index_
Index (e.g.
PortIdentifier::OwnerType owner_type_
Owner type.
This class provides the core functionality for managing a plugin, including creating/initializing the...
Lightweight UTF-8 string wrapper with safe conversions.
Base class for objects that need to be uniquely identified by UUID.