Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
channel_send.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2020-2021 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
10#ifndef __AUDIO_CHANNEL_SEND_H__
11#define __AUDIO_CHANNEL_SEND_H__
12
13#include "dsp/port.h"
14#include "dsp/port_identifier.h"
15#include "utils/yaml.h"
16
17typedef struct StereoPorts StereoPorts;
18typedef struct Track Track;
19typedef struct Port Port;
20typedef struct _ChannelSendWidget ChannelSendWidget;
22
29#define CHANNEL_SEND_SCHEMA_VERSION 1
30
35#define CHANNEL_SEND_POST_FADER_START_SLOT 6
36
37#define channel_send_is_prefader(x) \
38 (x->slot < CHANNEL_SEND_POST_FADER_START_SLOT)
39
40#define channel_send_is_in_active_project(self) \
41 (self->track && track_is_in_active_project (self->track))
42
57
61typedef struct ChannelSendTarget
62{
64
65 int track_pos;
66
67 PluginIdentifier pl_id;
68
69 char * port_group;
71
76char *
78
79char *
80channel_send_target_get_icon (const ChannelSendTarget * self);
81
82void
83channel_send_target_free (ChannelSendTarget * self);
84
91typedef struct ChannelSend
92{
93 int schema_version;
94
96 int slot;
97
104
111
118
125
129
137
140
143
145 unsigned int track_name_hash;
146
148
149NONNULL_ARGS (1)
150void channel_send_init_loaded (ChannelSend * self, Track * track);
151
156channel_send_new (unsigned int track_name_hash, int slot, Track * track);
157
161NONNULL Track *
163
164NONNULL bool
165channel_send_is_enabled (const ChannelSend * self);
166
167#define channel_send_is_empty(x) (!channel_send_is_enabled (x))
168
173NONNULL bool
175
182Track *
184
190NONNULL StereoPorts *
192
196NONNULL float
198
202NONNULL void
204
211bool
213 ChannelSend * self,
214 StereoPorts * stereo,
215 Port * l,
216 Port * r,
217 bool sidechain,
218 bool recalc_graph,
219 bool validate,
220 GError ** error);
221
225NONNULL bool
227 ChannelSend * self,
228 Port * port,
229 bool recalc_graph,
230 bool validate,
231 GError ** error);
232
236NONNULL void
237channel_send_disconnect (ChannelSend * self, bool recalc_graph);
238
239NONNULL void
240channel_send_set_amount (ChannelSend * self, float amount);
241
246NONNULL void
248
249NONNULL void
250channel_send_copy_values (ChannelSend * dest, const ChannelSend * src);
251
252NONNULL ChannelSend *
253channel_send_clone (const ChannelSend * src);
254
255NONNULL ChannelSendWidget *
256channel_send_find_widget (ChannelSend * self);
257
264void
266
267void
268channel_send_append_ports (ChannelSend * self, GPtrArray * ports);
269
275int
277 const ChannelSend * self,
278 const PortConnectionsManager * mgr,
279 GPtrArray * arr);
280
281void
282channel_send_prepare_process (ChannelSend * self);
283
284void
285channel_send_process (
286 ChannelSend * self,
287 const nframes_t local_offset,
288 const nframes_t nframes);
289
294bool
296 const ChannelSend * self,
297 const StereoPorts * stereo,
298 const Port * midi);
299
303NONNULL ChannelSend *
305
306NONNULL bool
307channel_send_validate (ChannelSend * self);
308
309NONNULL void
310channel_send_free (ChannelSend * self);
311
316#endif
Ports that transfer audio/midi/other signals to one another.
NONNULL_ARGS(1) int undo_manager_undo(UndoManager *self
Undo last action.
NONNULL Track * channel_send_get_track(const ChannelSend *self)
Gets the owner track.
NONNULL void channel_send_get_dest_name(ChannelSend *self, char *buf)
Get the name of the destination, or a placeholder text if empty.
Track * channel_send_get_target_track(ChannelSend *self, Track *owner)
Gets the target track.
NONNULL void channel_send_set_amount_from_widget(ChannelSend *self, float val)
Sets the amount from a widget amount (0.0-1.0).
bool channel_send_connect_stereo(ChannelSend *self, StereoPorts *stereo, Port *l, Port *r, bool sidechain, bool recalc_graph, bool validate, GError **error)
Connects a send to stereo ports.
int channel_send_append_connection(const ChannelSend *self, const PortConnectionsManager *mgr, GPtrArray *arr)
Appends the connection(s), if non-empty, to the given array (if not NULL) and returns the number of c...
bool channel_send_is_connected_to(const ChannelSend *self, const StereoPorts *stereo, const Port *midi)
Returns whether the send is connected to the given ports.
NONNULL bool channel_send_connect_midi(ChannelSend *self, Port *port, bool recalc_graph, bool validate, GError **error)
Connects a send to a midi port.
void channel_send_connect_to_owner(ChannelSend *self)
Connects the ports to the owner track if not connected.
ChannelSendTargetType
Target type.
ChannelSend * channel_send_new(unsigned int track_name_hash, int slot, Track *track)
Creates a channel send instance.
NONNULL ChannelSend * channel_send_find(ChannelSend *self)
Finds the project send from a given send instance.
NONNULL float channel_send_get_amount_for_widgets(ChannelSend *self)
Gets the amount to be used in widgets (0.0-1.0).
NONNULL void channel_send_disconnect(ChannelSend *self, bool recalc_graph)
Removes the connection at the given send.
NONNULL StereoPorts * channel_send_get_target_sidechain(ChannelSend *self)
Gets the target sidechain port.
NONNULL bool channel_send_is_target_sidechain(ChannelSend *self)
Returns whether the channel send target is a sidechain port (rather than a target track).
char * channel_send_target_describe(const ChannelSendTarget *self)
Returns a string describing self (track/plugin name/etc.).
@ CHANNEL_SEND_TARGET_TYPE_PLUGIN_SIDECHAIN
Send to plugin sidechain inputs.
@ CHANNEL_SEND_TARGET_TYPE_TRACK
Send to track inputs.
@ CHANNEL_SEND_TARGET_TYPE_NONE
Remove send.
uint32_t nframes_t
Frame count.
Definition types.h:39
Port identifier.
Send target (used in list views).
Channel send.
unsigned int track_name_hash
Track name hash (used in actions).
int slot
Slot index in the channel sends.
StereoPorts * stereo_in
Stereo input if audio send.
bool is_sidechain
If the send is a sidechain.
StereoPorts * stereo_out
Stereo output if audio send.
Port * enabled
Whether the send is currently enabled.
Port * midi_out
MIDI output if MIDI send.
Port * amount
Send amount (amplitude), 0 to 2 for audio, velocity multiplier for MIDI.
Port * midi_in
MIDI input if MIDI send.
Track * track
Pointer back to owner track.
Plugin identifier.
Port connections manager.
Must ONLY be created via port_new()
Definition port.h:136
L & R port, for convenience.
Definition port.h:501
Track to be inserted into the Project's Tracklist.
Definition track.h:177
YAML utils.