Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
port.h File Reference

Ports that transfer audio/midi/other signals to one another. More...

#include "zrythm-config.h"
#include <stdbool.h>
#include "dsp/port_identifier.h"
#include "plugins/lv2/lv2_evbuf.h"
#include "utils/types.h"
#include "zix/sem.h"
#include <lilv/lilv.h>
Include dependency graph for port.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  PortScalePoint
 Scale point. More...
 
struct  Port
 Must ONLY be created via port_new() More...
 
struct  StereoPorts
 L & R port, for convenience. More...
 

Macros

#define PORT_SCHEMA_VERSION   1
 
#define STEREO_PORTS_SCHEMA_VERSION   1
 
#define PORT_MAGIC   456861194
 
#define IS_PORT(_p)   (((Port *) (_p))->magic == PORT_MAGIC)
 
#define IS_PORT_AND_NONNULL(x)   ((x) && IS_PORT (x))
 
#define TIME_TO_RESET_PEAK   4800000
 
#define PORT_NOT_OWNED   -1
 Special ID for owner_pl, owner_ch, etc.
 
#define port_is_owner_active(self, _owner_type, owner)
 
#define port_is_in_active_project(self)
 
#define port_connect(a, b, locked)
 Connects a and b with default settings:
 
#define port_disconnect(a, b)
 Removes the connection between the given ports.
 
#define ports_connected(a, b)
 
#define port_clear_buffer(_port)
 Clears the port buffer.
 

Typedefs

typedef struct ZixRingImpl ZixRing
 
typedef struct WindowsMmeDevice WindowsMmeDevice
 
typedef struct RtMidiDevice RtMidiDevice
 
typedef struct RtAudioDevice RtAudioDevice
 
typedef enum PanAlgorithm PanAlgorithm
 
typedef enum PanLaw PanLaw
 

Enumerations

enum  PortInternalType {
  INTERNAL_NONE , INTERNAL_LV2_PORT , INTERNAL_JACK_PORT , INTERNAL_PA_PORT ,
  INTERNAL_ALSA_SEQ_PORT
}
 What the internal data is. More...
 

Functions

PURE int port_scale_point_cmp (const void *_a, const void *_b)
 
NONNULL PortScalePointport_scale_point_new (const float val, const char *label)
 
NONNULL void port_scale_point_free (PortScalePoint *self)
 
NONNULL void port_init_loaded (Port *self, void *owner)
 This function finds the Ports corresponding to the PortIdentifiers for srcs and dests.
 
void port_set_owner (Port *self, PortOwnerType owner_type, void *owner)
 
NONNULL Portport_find_from_identifier (const PortIdentifier *const id)
 
WARN_UNUSED_RESULT NONNULL Portport_new_with_type (PortType type, PortFlow flow, const char *label)
 Creates port.
 
WARN_UNUSED_RESULT NONNULL Portport_new_with_type_and_owner (PortType type, PortFlow flow, const char *label, PortOwnerType owner_type, void *owner)
 
NONNULL void port_allocate_bufs (Port *self)
 Allocates buffers used during DSP.
 
NONNULL void port_free_bufs (Port *self)
 Frees buffers.
 
NONNULL StereoPortsstereo_ports_new_from_existing (Port *l, Port *r)
 Creates blank stereo ports.
 
StereoPortsstereo_ports_new_generic (int in, const char *name, const char *symbol, PortOwnerType owner_type, void *owner)
 Creates stereo ports for generic use.
 
NONNULL void stereo_ports_connect (StereoPorts *src, StereoPorts *dest, int locked)
 Connects the internal ports using port_connect().
 
NONNULL void stereo_ports_disconnect (StereoPorts *self)
 
StereoPortsstereo_ports_clone (const StereoPorts *src)
 
NONNULL void stereo_ports_free (StereoPorts *self)
 
const void * port_get_value_from_symbol (const char *port_sym, void *user_data, uint32_t *size, uint32_t *type)
 Function to get a port's value from its string symbol.
 
NONNULL bool port_has_sound (Port *self)
 If MIDI port, returns if there are any events, if audio port, returns if there is sound in the buffer.
 
NONNULL void port_get_full_designation (Port *const self, char *buf)
 Copies a full designation of self in the format "Track/Port" or "Track/Plugin/Port" in buf.
 
NONNULL void port_print_full_designation (Port *const self)
 
void port_get_all (GPtrArray *ports)
 Gathers all ports in the project and appends them in the given array.
 
NONNULL Trackport_get_track (const Port *const self, int warn_if_fail)
 
NONNULL Pluginport_get_plugin (Port *const self, const bool warn_if_fail)
 
void port_update_identifier (Port *self, const PortIdentifier *prev_id, Track *track, bool update_automation_track)
 To be called when the port's identifier changes to update corresponding identifiers.
 
NONNULL void port_disconnect_hw_inputs (Port *self)
 Disconnects all hardware inputs from the port.
 
NONNULL void port_set_expose_to_backend (Port *self, int expose)
 Sets whether to expose the port to the backend and exposes it or removes it.
 
NONNULL void port_rename_backend (Port *self)
 Renames the port on the backend side.
 
NONNULL void port_set_control_value (Port *self, const float val, const bool is_normalized, const bool forward_event)
 Sets the given control value to the corresponding underlying structure in the Port.
 
NONNULL HOT float port_get_control_value (Port *self, const bool normalize)
 Gets the given control value from the corresponding underlying structure in the Port.
 
NONNULL int port_get_num_unlocked_srcs (const Port *self)
 Returns the number of unlocked (user-editable) sources.
 
NONNULL int port_get_num_unlocked_dests (const Port *self)
 Returns the number of unlocked (user-editable) destinations.
 
void port_update_track_name_hash (Port *self, Track *track, unsigned int new_hash)
 Updates the track name hash on a track port and all its source/destination identifiers.
 
HOT NONNULL void port_process (Port *port, const EngineProcessTimeInfo time_nfo, const bool noroll)
 First sets port buf to 0, then sums the given port signal from its inputs.
 
NONNULL bool ports_can_be_connected (const Port *src, const Port *dest)
 Returns whether the Port's can be connected (if the connection will be valid and won't break the acyclicity of the graph).
 
NONNULL void ports_disconnect (Port **ports, int num_ports, int deleting)
 Disconnects all the given ports.
 
NONNULL void port_copy_metadata_from_project (Port *self, Port *project_port)
 Copies the metadata from a project port to the given port.
 
NONNULL void port_copy_values (Port *self, const Port *other)
 Copies the port values from other to self.
 
NONNULL void port_restore_from_non_project (Port *self, Port *non_project)
 Reverts the data on the corresponding project port for the given non-project port.
 
HOT NONNULL OPTIMIZE_O3 void port_clear_external_buffer (Port *port)
 Clears the backend's port buffer.
 
NONNULL int port_disconnect_all (Port *port)
 Disconnects all srcs and dests from port.
 
NONNULL void port_apply_pan_stereo (Port *l, Port *r, float pan, PanLaw pan_law, PanAlgorithm pan_algo)
 Applies the pan to the given L/R ports.
 
NONNULL void port_apply_pan (Port *port, float pan, PanLaw pan_law, PanAlgorithm pan_algo, nframes_t start_frame, const nframes_t nframes)
 Applies the pan to the given port.
 
NONNULL uint32_t port_get_hash (const void *ptr)
 Generates a hash for a given port.
 
Portport_clone (const Port *src)
 To be used during serialization.
 
NONNULL void port_free (Port *port)
 Deletes port, doing required cleanup and updating counters.
 

Detailed Description

Ports that transfer audio/midi/other signals to one another.

Definition in file port.h.

Typedef Documentation

◆ PanAlgorithm

typedef enum PanAlgorithm PanAlgorithm

Definition at line 58 of file port.h.

◆ PanLaw

typedef enum PanLaw PanLaw

Definition at line 59 of file port.h.

◆ RtAudioDevice

typedef struct RtAudioDevice RtAudioDevice

Definition at line 49 of file port.h.

◆ RtMidiDevice

typedef struct RtMidiDevice RtMidiDevice

Definition at line 48 of file port.h.

◆ WindowsMmeDevice

typedef struct WindowsMmeDevice WindowsMmeDevice

Definition at line 41 of file port.h.

◆ ZixRing

typedef struct ZixRingImpl ZixRing

Definition at line 40 of file port.h.