Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::graph::GraphNode Class Reference

Represents a node in a DSP graph. More...

#include <src/dsp/graph_node.h>

Public Types

using NodeId = int

Public Member Functions

 GraphNode (NodeId id, IProcessable &processable)
std::string print_node_to_str () const
 For general debugging.
void print_node () const
NodeId get_id () const
void process (EngineProcessTimeInfo time_nfo, nframes_t remaining_preroll_frames, const dsp::ITransport &transport) const
 Processes the GraphNode.
nframes_t get_single_playback_latency () const
void set_route_playback_latency (nframes_t dest_latency)
 Sets the playback latency of the given node recursively.
void connect_to (GraphNode &target)
void set_skip_processing (bool skip)
 Sets whether processing should be skipped for this node.
IProcessableget_processable ()
auto & feeds () const
 Read-only access to child nodes (outgoing connections).
auto & depends () const
 Read-only access to parent nodes (incoming connections).
bool remove_feed (const GraphNode &feed)
bool remove_depend (const GraphNode &depend)

Data Fields

std::atomic< int > refcount_ = 0
 Incoming node count.
nframes_t playback_latency_ = 0
 The playback latency of the node, in samples.
nframes_t capture_latency_ = 0
 The capture latency of the node, in samples.
int init_refcount_ = 0
 Initial incoming node count.
nframes_t route_playback_latency_ = 0
 The route's playback latency so far.
bool terminal_ = false
bool initial_ = false

Detailed Description

Represents a node in a DSP graph.

GraphNode is a fundamental building block of the DSP graph, responsible for processing audio/MIDI data. It encapsulates the necessary functions and properties to handle the processing, latency compensation, and connection management within the graph.

The class provides the following key features:

  • Configurable processing function and name getter
  • Playback latency management and compensation
  • Ability to connect to other GraphNode instances
  • Skipping of processing for muting/disabling the node

GraphNode is designed to be used as part of the larger DSP graph system, providing the necessary functionality to handle the individual nodes and their interactions.

Definition at line 128 of file graph_node.h.

Member Typedef Documentation

◆ NodeId

using zrythm::dsp::graph::GraphNode::NodeId = int

Definition at line 131 of file graph_node.h.

Member Function Documentation

◆ depends()

auto & zrythm::dsp::graph::GraphNode::depends ( ) const
inline

Read-only access to parent nodes (incoming connections).

Definition at line 196 of file graph_node.h.

◆ feeds()

auto & zrythm::dsp::graph::GraphNode::feeds ( ) const
inline

Read-only access to child nodes (outgoing connections).

Definition at line 191 of file graph_node.h.

◆ get_id()

NodeId zrythm::dsp::graph::GraphNode::get_id ( ) const
inline

Definition at line 143 of file graph_node.h.

◆ get_processable()

IProcessable & zrythm::dsp::graph::GraphNode::get_processable ( )
inline

Definition at line 186 of file graph_node.h.

◆ get_single_playback_latency()

nframes_t zrythm::dsp::graph::GraphNode::get_single_playback_latency ( ) const
inline

Definition at line 160 of file graph_node.h.

◆ process()

void zrythm::dsp::graph::GraphNode::process ( EngineProcessTimeInfo time_nfo,
nframes_t remaining_preroll_frames,
const dsp::ITransport & transport ) const

Processes the GraphNode.

Parameters
remaining_preroll_framesThe number of frames remaining for preroll (as part of playback latency adjustment).
processing_cycle_in_progressWhether the processing cycle is currently in progress (and this function is called as part of it), as opposed to being called before/after a processing cycle (e.g., for some special nodes that are processed before/after the actual processing).

◆ set_route_playback_latency()

void zrythm::dsp::graph::GraphNode::set_route_playback_latency ( nframes_t dest_latency)

Sets the playback latency of the given node recursively.

Used only when (re)creating the graph.

Parameters
dest_latencyThe total destination latency so far.

◆ set_skip_processing()

void zrythm::dsp::graph::GraphNode::set_skip_processing ( bool skip)
inline

Sets whether processing should be skipped for this node.

When set to true, the node's processing function will be bypassed, effectively muting/disabling the node while keeping it in the graph.

Parameters
skipTrue to skip processing, false to process normally

Definition at line 184 of file graph_node.h.

Field Documentation

◆ capture_latency_

nframes_t zrythm::dsp::graph::GraphNode::capture_latency_ = 0

The capture latency of the node, in samples.

See also
Page 116 of "The Ardour DAW - Latency Compensation and Anywhere-to-Anywhere Signal Routing Systems".

Definition at line 252 of file graph_node.h.

◆ init_refcount_

int zrythm::dsp::graph::GraphNode::init_refcount_ = 0

Initial incoming node count.

Definition at line 255 of file graph_node.h.

◆ initial_

bool zrythm::dsp::graph::GraphNode::initial_ = false

Definition at line 263 of file graph_node.h.

◆ playback_latency_

nframes_t zrythm::dsp::graph::GraphNode::playback_latency_ = 0

The playback latency of the node, in samples.

See also
Page 116 of "The Ardour DAW - Latency Compensation and Anywhere-to-Anywhere Signal Routing Systems".

Definition at line 243 of file graph_node.h.

◆ refcount_

std::atomic<int> zrythm::dsp::graph::GraphNode::refcount_ = 0

Incoming node count.

Definition at line 235 of file graph_node.h.

◆ route_playback_latency_

nframes_t zrythm::dsp::graph::GraphNode::route_playback_latency_ = 0

The route's playback latency so far.

Definition at line 258 of file graph_node.h.

◆ terminal_

bool zrythm::dsp::graph::GraphNode::terminal_ = false

Definition at line 262 of file graph_node.h.


The documentation for this class was generated from the following file: