Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
port_connection.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2021-2022 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_PORT_CONNECTION_H__
11#define __AUDIO_PORT_CONNECTION_H__
12
13#include "zrythm-config.h"
14
15#include <stdbool.h>
16
17#include "dsp/port_identifier.h"
18#include "utils/yaml.h"
19
26#define PORT_CONNECTION_SCHEMA_VERSION 1
27
31typedef struct PortConnection
32{
33 int schema_version;
34
35 PortIdentifier * src_id;
36 PortIdentifier * dest_id;
37
45
54 bool locked;
55
62 bool enabled;
63
67
68static const cyaml_schema_field_t port_connection_fields_schema[] = {
69 YAML_FIELD_INT (PortConnection, schema_version),
70 YAML_FIELD_MAPPING_PTR (PortConnection, src_id, port_identifier_fields_schema),
71 YAML_FIELD_MAPPING_PTR (PortConnection, dest_id, port_identifier_fields_schema),
72 YAML_FIELD_FLOAT (PortConnection, multiplier),
73 YAML_FIELD_INT (PortConnection, locked),
74 YAML_FIELD_INT (PortConnection, enabled),
75 YAML_FIELD_FLOAT (PortConnection, base_value),
76
77 CYAML_FIELD_END
78};
79
80static const cyaml_schema_value_t port_connection_schema = {
81 YAML_VALUE_PTR (PortConnection, port_connection_fields_schema),
82};
83
85port_connection_new (
86 const PortIdentifier * src,
87 const PortIdentifier * dest,
88 float multiplier,
89 bool locked,
90 bool enabled);
91
92NONNULL void
93port_connection_update (
94 PortConnection * self,
95 float multiplier,
96 bool locked,
97 bool enabled);
98
99NONNULL PURE bool
100port_connection_is_send (const PortConnection * self);
101
102NONNULL void
103port_connection_print_to_str (
104 const PortConnection * self,
105 char * buf,
106 size_t buf_sz);
107
108NONNULL void
109port_connection_print (const PortConnection * self);
110
114NONNULL PortConnection *
116
120NONNULL void
122
127#endif /* __AUDIO_PORT_CONNECTION_H__ */
NONNULL PortConnection * port_connection_clone(const PortConnection *src)
To be used during serialization.
NONNULL void port_connection_free(PortConnection *self)
Deletes port, doing required cleanup and updating counters.
#define YAML_FIELD_MAPPING_PTR(owner, member, schema)
Mapping pointer to a struct.
Definition yaml.h:37
#define YAML_VALUE_PTR(cc, fields_schema)
Schema to be used as a pointer.
Definition yaml.h:202
Port identifier.
A connection between two ports.
bool enabled
Whether the connection is enabled.
float multiplier
Multiplier to apply, where applicable.
bool locked
Whether the connection can be removed or the multiplier edited by the user.
float base_value
Used for CV -> control port connections.
Struct used to identify Ports in the project.
YAML utils.