Zrythm
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
graph_node.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: © 2019-2021 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3/*
4 * This file incorporates work covered by the following copyright and
5 * permission notice:
6 *
7 * ---
8 *
9 * Copyright (C) 2017, 2019 Robin Gareus <robin@gareus.org>
10 *
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 *
24 * SPDX-License-Identifier: GPL-2.0-or-later
25 *
26 * ---
27 */
28
35#ifndef __AUDIO_GRAPH_NODE_H__
36#define __AUDIO_GRAPH_NODE_H__
37
38#include <stdbool.h>
39
40#include "utils/types.h"
41
42#include <gtk/gtk.h>
43
44TYPEDEF_STRUCT (GraphNode);
45TYPEDEF_STRUCT (Graph);
46TYPEDEF_STRUCT (PassthroughProcessor);
47TYPEDEF_STRUCT (Port);
48TYPEDEF_STRUCT (Fader);
49TYPEDEF_STRUCT (Track);
50TYPEDEF_STRUCT (SampleProcessor);
51TYPEDEF_STRUCT (Plugin);
52TYPEDEF_STRUCT (HardwareProcessor);
53TYPEDEF_STRUCT (ModulatorMacroProcessor);
54TYPEDEF_STRUCT (EngineProcessTimeInfo);
55TYPEDEF_STRUCT (ChannelSend);
56
101
105typedef struct GraphNode
106{
107 int id;
111
117 int n_childnodes;
118
121
124
128
131
134
137
138 Track * track;
139
142
145
148
149 ModulatorMacroProcessor * modulator_macro_processor;
150
151 ChannelSend * send;
152
155 bool initial;
156
160
163
164 GraphNodeType type;
165} GraphNode;
166
172char *
174
175void *
176graph_node_get_pointer (GraphNode * self);
177
178void
179graph_node_print_to_str (GraphNode * node, char * buf, size_t buf_sz);
180
181void
182graph_node_print (GraphNode * node);
183
187HOT void
189
196HOT nframes_t
198
208void
210
215HOT void
217
218void
219graph_node_connect (GraphNode * from, GraphNode * to);
220
221GraphNode *
222graph_node_new (Graph * graph, GraphNodeType type, void * data);
223
224void
225graph_node_free (GraphNode * node);
226
231#endif
GraphNodeType
Graph nodes can be either ports or processors.
Definition graph_node.h:69
void graph_node_set_route_playback_latency(GraphNode *node, nframes_t dest_latency)
Sets the playback latency of the given node recursively.
HOT void graph_node_trigger(GraphNode *self)
Called by an upstream node when it has completed processing.
HOT void graph_node_process(GraphNode *node, EngineProcessTimeInfo time_nfo)
Processes the GraphNode.
char * graph_node_get_name(GraphNode *node)
Returns a human friendly name of the node.
HOT nframes_t graph_node_get_single_playback_latency(GraphNode *node)
Returns the latency of only the given port, without adding the previous/next latencies.
@ ROUTE_NODE_TYPE_PREFADER
Pre-Fader passthrough processor.
Definition graph_node.h:81
@ ROUTE_NODE_TYPE_CHANNEL_SEND
Channel send.
Definition graph_node.h:99
@ ROUTE_NODE_TYPE_TRACK
Track processor.
Definition graph_node.h:75
@ ROUTE_NODE_TYPE_INITIAL_PROCESSOR
Initial processor.
Definition graph_node.h:91
@ ROUTE_NODE_TYPE_SAMPLE_PROCESSOR
Sample processor.
Definition graph_node.h:83
@ ROUTE_NODE_TYPE_FADER
Fader/pan processor.
Definition graph_node.h:77
@ ROUTE_NODE_TYPE_MONITOR_FADER
Fader/pan processor for monitor.
Definition graph_node.h:79
@ ROUTE_NODE_TYPE_PLUGIN
Plugin processor.
Definition graph_node.h:73
@ ROUTE_NODE_TYPE_HW_PROCESSOR
Hardware processor.
Definition graph_node.h:94
@ ROUTE_NODE_TYPE_PORT
Port.
Definition graph_node.h:71
uint32_t nframes_t
Frame count.
Definition types.h:35
Channel send.
Common struct to pass around during processing to avoid repeating the data in function arguments.
Definition types.h:138
A Fader is a processor that is used for volume controls and pan.
Definition fader.h:118
A node in the processing graph.
Definition graph_node.h:106
nframes_t route_playback_latency
The route's playback latency so far.
Definition graph_node.h:162
Fader * fader
Fader, if fader.
Definition graph_node.h:136
gint refcount
Incoming node count.
Definition graph_node.h:120
GraphNode ** childnodes
outgoing edges downstream nodes to activate when this node has completed processed
Definition graph_node.h:116
GraphNode ** parentnodes
Used when creating the graph so we can traverse it backwards to set the latencies.
Definition graph_node.h:127
HardwareProcessor * hw_processor
Hardware processor, if hardware processor.
Definition graph_node.h:147
gint init_refcount
Initial incoming node count.
Definition graph_node.h:123
bool terminal
For debugging.
Definition graph_node.h:154
nframes_t playback_latency
The playback latency of the node, in samples.
Definition graph_node.h:159
Port * port
Port, if not a plugin or fader.
Definition graph_node.h:130
Fader * prefader
Pre-Fader, if prefader node.
Definition graph_node.h:141
SampleProcessor * sample_processor
Sample processor, if sample processor.
Definition graph_node.h:144
Plugin * pl
Plugin, if plugin.
Definition graph_node.h:133
Graph * graph
Ref back to the graph so we don't have to pass it around.
Definition graph_node.h:110
Graph.
Definition graph.h:71
Hardware processor.
Modulator macro button processor.
The base plugin Inheriting plugins must have this as a child.
Definition plugin.h:74
Must ONLY be created via port_new()
Definition port.h:138
A processor to be used in the routing graph for playing samples independent of the timeline.
Track to be inserted into the Project's Tracklist.
Definition track.h:186
Custom types.