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)
 GraphNode (const GraphNode &)=delete
GraphNode & operator= (const GraphNode &)=delete
 GraphNode (GraphNode &&)=delete
GraphNode & operator= (GraphNode &&)=delete
std::string print_node_to_str () const
 For general debugging.
NodeId get_id () const
void process (dsp::graph::EngineProcessTimeInfo time_nfo, units::sample_u64_t remaining_preroll_frames, const dsp::ITransport &transport, const dsp::TempoMap &tempo_map) const
 Processes the GraphNode.
units::sample_u32_t get_single_playback_latency () const
void set_route_playback_latency (units::sample_u32_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.
units::sample_u32_t playback_latency_
 The playback latency of the node, in samples.
units::sample_u32_t capture_latency_
 The capture latency of the node, in samples.
int init_refcount_ {}
 Initial incoming node count.
units::sample_u32_t route_playback_latency_
 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 159 of file graph_node.h.

Member Typedef Documentation

◆ NodeId

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

Definition at line 162 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 229 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 224 of file graph_node.h.

◆ get_id()

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

Definition at line 175 of file graph_node.h.

◆ get_processable()

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

Definition at line 219 of file graph_node.h.

◆ get_single_playback_latency()

units::sample_u32_t zrythm::dsp::graph::GraphNode::get_single_playback_latency ( ) const
inline

Definition at line 193 of file graph_node.h.

◆ process()

void zrythm::dsp::graph::GraphNode::process ( dsp::graph::EngineProcessTimeInfo time_nfo,
units::sample_u64_t remaining_preroll_frames,
const dsp::ITransport & transport,
const dsp::TempoMap & tempo_map ) 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 ( units::sample_u32_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 217 of file graph_node.h.

Field Documentation

◆ capture_latency_

units::sample_u32_t zrythm::dsp::graph::GraphNode::capture_latency_

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 287 of file graph_node.h.

◆ init_refcount_

int zrythm::dsp::graph::GraphNode::init_refcount_ {}

Initial incoming node count.

Definition at line 290 of file graph_node.h.

◆ initial_

bool zrythm::dsp::graph::GraphNode::initial_ { false }

Definition at line 298 of file graph_node.h.

◆ playback_latency_

units::sample_u32_t zrythm::dsp::graph::GraphNode::playback_latency_

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 278 of file graph_node.h.

◆ refcount_

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

Incoming node count.

Definition at line 270 of file graph_node.h.

◆ route_playback_latency_

units::sample_u32_t zrythm::dsp::graph::GraphNode::route_playback_latency_

The route's playback latency so far.

Definition at line 293 of file graph_node.h.

◆ terminal_

bool zrythm::dsp::graph::GraphNode::terminal_ { false }

Definition at line 297 of file graph_node.h.


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