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 "utils/types.h"
39
40#include "gtk_wrapper.h"
41
42TYPEDEF_STRUCT (GraphNode);
43TYPEDEF_STRUCT (Graph);
44TYPEDEF_STRUCT (PassthroughProcessor);
45TYPEDEF_STRUCT (Port);
46TYPEDEF_STRUCT (Fader);
47TYPEDEF_STRUCT (Track);
48TYPEDEF_STRUCT (SampleProcessor);
49TYPEDEF_STRUCT (Plugin);
50TYPEDEF_STRUCT (HardwareProcessor);
51TYPEDEF_STRUCT (ModulatorMacroProcessor);
52TYPEDEF_STRUCT (EngineProcessTimeInfo);
53TYPEDEF_STRUCT (ChannelSend);
54
99
103typedef struct GraphNode
104{
105 int id;
109
115 int n_childnodes;
116
119
122
126
129
132
135
136 Track * track;
137
140
143
146
147 ModulatorMacroProcessor * modulator_macro_processor;
148
149 ChannelSend * send;
150
153 bool initial;
154
158
161
162 GraphNodeType type;
163} GraphNode;
164
170char *
172
173void *
174graph_node_get_pointer (GraphNode * self);
175
176void
177graph_node_print_to_str (GraphNode * node, char * buf, size_t buf_sz);
178
179void
180graph_node_print (GraphNode * node);
181
185HOT void
187
194HOT nframes_t
196
206void
208
213HOT void
215
216void
217graph_node_connect (GraphNode * from, GraphNode * to);
218
219GraphNode *
220graph_node_new (Graph * graph, GraphNodeType type, void * data);
221
222void
223graph_node_free (GraphNode * node);
224
229#endif
GraphNodeType
Graph nodes can be either ports or processors.
Definition graph_node.h:67
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_CHANNEL_SEND
Channel send.
@ ROUTE_NODE_TYPE_INITIAL_PROCESSOR
Initial processor.
@ ROUTE_NODE_TYPE_FADER
Fader/pan processor.
@ ROUTE_NODE_TYPE_PORT
Port.
@ ROUTE_NODE_TYPE_HW_PROCESSOR
Hardware processor.
@ ROUTE_NODE_TYPE_MONITOR_FADER
Fader/pan processor for monitor.
@ ROUTE_NODE_TYPE_PREFADER
Pre-Fader passthrough processor.
@ ROUTE_NODE_TYPE_PLUGIN
Plugin processor.
@ ROUTE_NODE_TYPE_TRACK
Track processor.
@ ROUTE_NODE_TYPE_SAMPLE_PROCESSOR
Sample processor.
uint32_t nframes_t
Frame count.
Definition types.h:39
Channel send.
Common struct to pass around during processing to avoid repeating the data in function arguments.
Definition types.h:142
A Fader is a processor that is used for volume controls and pan.
Definition fader.h:91
A node in the processing graph.
Definition graph_node.h:104
nframes_t route_playback_latency
The route's playback latency so far.
Definition graph_node.h:160
Fader * fader
Fader, if fader.
Definition graph_node.h:134
gint refcount
Incoming node count.
Definition graph_node.h:118
GraphNode ** childnodes
outgoing edges downstream nodes to activate when this node has completed processed
Definition graph_node.h:114
GraphNode ** parentnodes
Used when creating the graph so we can traverse it backwards to set the latencies.
Definition graph_node.h:125
HardwareProcessor * hw_processor
Hardware processor, if hardware processor.
Definition graph_node.h:145
gint init_refcount
Initial incoming node count.
Definition graph_node.h:121
bool terminal
For debugging.
Definition graph_node.h:152
nframes_t playback_latency
The playback latency of the node, in samples.
Definition graph_node.h:157
Port * port
Port, if not a plugin or fader.
Definition graph_node.h:128
Fader * prefader
Pre-Fader, if prefader node.
Definition graph_node.h:139
SampleProcessor * sample_processor
Sample processor, if sample processor.
Definition graph_node.h:142
Plugin * pl
Plugin, if plugin.
Definition graph_node.h:131
Graph * graph
Ref back to the graph so we don't have to pass it around.
Definition graph_node.h:108
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:136
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:177
Custom types.