Port struct

Must ONLY be created via port_new()

Contents

Public variables

int exposed_to_backend
Flag to indicate that this port is exposed to the backend.
float* buf
Buffer to be reallocated every time the buffer size changes.
MidiEvents* midi_events
Contains raw MIDI data (MIDI ports only)
struct Port** srcs
Inputs and Outputs.
float* multipliers
These are the multipliers for port connections.
float* src_multipliers
Same as above for sources.
int* dest_locked
These indicate whether the destination Port can be removed or the multiplier edited by the user.
int* src_locked
Same as above for sources.
int* dest_enabled
These indicate whether the connection is enabled.
int* src_enabled
Same as above for sources.
int num_srcs
Counters.
size_t srcs_size
Allocated sizes.
PortInternalType internal_type
Indicates whether data or lv2_port should be used.
float minf
Minimum, maximum and zero values for this port.
float zerof
The zero position of the port.
float deff
Default value, only used for controls.
int vst_param_id
VST parameter index, if VST control port.
int carla_param_id
Index of the control parameter (for Carla plugin ports).
void* data
Pointer to arbitrary data.
gint64 last_midi_dequeue
Last time the port finished dequeueing MIDI events.
PortScalePoint* scale_points
Scale points.
float control
The control value if control port, otherwise 0.0f.
float unsnapped_control
Unsnapped value, used by widgets.
bool value_changed_from_reading
Flag that the value of the port changed from reading automation.
gint64 last_change
Last timestamp the control changed.
Plugin* tmp_plugin
Temporary plugin pointer (used when the plugin doesn't exist yet in its supposed slot).
SampleProcessor* sample_processor
Temporary track (used when the track doesn't exist yet in its supposed position).
int initialized
used when loading projects FIXME needed?
float base_value
For control ports, when a modulator is attached to the port the previous value will be saved here.
long capture_latency
When a modulator is attached to a control port this will be set to 1, and set back to 0 when all modulators are disconnected.
long playback_latency
Playback latency.
int deleting
Port undergoing deletion.
bool write_ring_buffers
Flag to indicate if the ring buffers below should be filled or not.
int has_midi_events
Whether the port has midi events not yet processed by the UI.
gint64 last_midi_event_time
Used by the UI to detect when unprocessed MIDI events exist.
ZixRing* audio_ring
Ring buffer for saving the contents of the audio buffer to be used in the UI instead of directly accessing the buffer.
ZixRing* midi_ring
Ring buffer for saving MIDI events to be used in the UI instead of directly accessing the events.
float peak
Max amplitude during processing, if audio (fabsf).
gint64 peak_timestamp
Last time Port.max_amp was set.
midi_byte_t last_midi_status
Last known MIDI status byte received.
const LilvPort* lilv_port
LV2 port.
LV2_URID value_type
Float for LV2 control ports, declared type for LV2 parameters.
LV2_Evbuf* evbuf
For MIDI ports, otherwise NULL.
PluginGtkController* widget
Control widget, if applicable.
size_t min_buf_size
Minimum buffer size that the port wants, or 0.
int lilv_port_index
Port index in the lilv plugin, if non-parameter.
bool received_ui_event
Whether the port received a UI event from the plugin UI in this cycle.
float last_sent_control
The last known control value sent to the UI (if control).
bool automating
Whether this value was set via automation.
bool old_api
True for event, false for atom.
AutomationTrack* at
Automation track this port is attached to.
ExtPort* ext_port
Pointer to ExtPort, if hw, for quick access (cache).
bool is_project
Whether this is a project port.
int magic
Magic number to identify that this is a Port.

Variable documentation

float* Port::buf

Buffer to be reallocated every time the buffer size changes.

The buffer size is AUDIO_ENGINE->block_length.

struct Port** Port::srcs

Inputs and Outputs.

These should be serialized, and when loading they shall be used to find the original ports and replace the pointer (also freeing the current one).

float* Port::multipliers

These are the multipliers for port connections.

They range from 0.f to 1.f and the default is 1.f. They correspond to each destination.

int* Port::dest_locked

These indicate whether the destination Port can be removed or the multiplier edited by the user.

These are ignored when connecting things internally and are only used to deter the user from breaking necessary connections.

0 == unlocked, 1 == locked.

int* Port::dest_enabled

These indicate whether the connection is enabled.

The user can disable port connections only if they are not locked.

0 == disabled (disconnected), 1 == enabled (connected).

float Port::minf

Minimum, maximum and zero values for this port.

Note that for audio, this is the amp (0 - 2) and not the actual values.

float Port::zerof

The zero position of the port.

For example, in balance controls, this will be the middle. In audio ports, this will be 0 amp (silence), etc.

void* Port::data

Pointer to arbitrary data.

Use internal_type to check what data it is.

FIXME just add the various data structs here and remove this ambiguity.

gint64 Port::last_midi_dequeue

Last time the port finished dequeueing MIDI events.

Used for some backends only.

float Port::control

The control value if control port, otherwise 0.0f.

FIXME for fader, this should be the fader_val (0.0 to 1.0) and not the amplitude.

This value will be snapped (eg, if integer or toggle).

gint64 Port::last_change

Last timestamp the control changed.

This is used when recording automation in "touch" mode.

float Port::base_value

For control ports, when a modulator is attached to the port the previous value will be saved here.

Automation in AutomationTrack's will overwrite this value.

long Port::capture_latency

When a modulator is attached to a control port this will be set to 1, and set back to 0 when all modulators are disconnected.

Capture latency.

See page 116 of "The Ardour DAW - Latency Compensation and Anywhere-to-Anywhere Signal Routing Systems".

long Port::playback_latency

Playback latency.

See page 116 of "The Ardour DAW - Latency Compensation and Anywhere-to-Anywhere Signal Routing Systems".

bool Port::write_ring_buffers

Flag to indicate if the ring buffers below should be filled or not.

If a UI element that needs them becomes mapped (visible), this should be set to 1, and when unmapped (invisible) it should be set to 0.

ZixRing* Port::audio_ring

Ring buffer for saving the contents of the audio buffer to be used in the UI instead of directly accessing the buffer.

This should contain blocks of block_length samples and should maintain at least 10 cycles' worth of buffers.

This is also used for CV.

ZixRing* Port::midi_ring

Ring buffer for saving MIDI events to be used in the UI instead of directly accessing the events.

This should keep pushing MidiEvent's whenever they occur and the reader should empty it after cheking if there are any events.

Currently there is only 1 reader for each port so this wont be a problem for now, but we should have one ring for each reader.

midi_byte_t Port::last_midi_status

Last known MIDI status byte received.

Used for running status (see http://midi.teragonaudio.com/tech/midispec/run.htm).

Not needed for JACK.

PluginGtkController* Port::widget

Control widget, if applicable.

Only used for generic UIs.

size_t Port::min_buf_size

Minimum buffer size that the port wants, or 0.

Used by LV2 plugin ports.

bool Port::received_ui_event

Whether the port received a UI event from the plugin UI in this cycle.

This is used to avoid re-sending that event to the plugin.

float Port::last_sent_control

The last known control value sent to the UI (if control).

@seealso lv2_ui_send_control_val_event_from_plugin_to_ui().

AutomationTrack* Port::at

Automation track this port is attached to.

To be set at runtime only (not serialized).