Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
Router Class Referencefinal

The Router class manages the processing graph for the audio engine. More...

#include <src/gui/dsp/router.h>

Collaboration diagram for Router:

Public Member Functions

 Router (AudioEngine *engine=nullptr)
 
void recalc_graph (bool soft)
 Recalculates the process acyclic directed graph.
 
void start_cycle (EngineProcessTimeInfo time_nfo)
 Starts a new cycle.
 
nframes_t get_max_route_playback_latency ()
 Returns the max playback latency of the trigger nodes.
 
bool is_processing_kickoff_thread () const
 Returns whether this is the thread that kicks off processing (thread that calls router_start_cycle()).
 
bool is_processing_thread () const
 Returns if the current thread is a processing thread.
 
void queue_control_port_change (const ControlPort::ChangeEvent &change)
 Queues a control port change to be applied when processing starts.
 

Data Fields

std::unique_ptr< dsp::graph::GraphSchedulerscheduler_
 
std::atomic< bool > graph_setup_in_progress_ = false
 An atomic variable to check if the graph is currently being setup (so that we can avoid accessing buffers changed by this).
 
EngineProcessTimeInfo time_nfo_
 Time info for this processing cycle.
 
nframes_t max_route_playback_latency_ = 0
 Stored for the currently processing cycle.
 
nframes_t global_offset_ = 0
 Current global latency offset (max latency of all routes - remaining latency from engine).
 
std::binary_semaphore graph_access_sem_ { 1 }
 Used when recalculating the graph.
 
bool callback_in_progress_ = false
 
unsigned int process_kickoff_thread_ = 0
 ID of the thread that calls kicks off the cycle.
 
RingBuffer< ControlPort::ChangeEventctrl_port_change_queue_ { 32 }
 Message queue for control port changes, used for BPM/time signature changes.
 
AudioEngineaudio_engine_ = nullptr
 

Detailed Description

The Router class manages the processing graph for the audio engine.

The Router class is responsible for maintaining the active processing graph, handling graph setup and recalculation, and managing the processing cycle. It provides methods for starting a new processing cycle, retrieving the maximum playback latency, and checking the current processing thread.

Definition at line 54 of file router.h.

Member Function Documentation

◆ is_processing_kickoff_thread()

bool Router::is_processing_kickoff_thread ( ) const
inlinenodiscard

Returns whether this is the thread that kicks off processing (thread that calls router_start_cycle()).

Definition at line 81 of file router.h.

◆ is_processing_thread()

bool Router::is_processing_thread ( ) const
inlinenodiscard

Returns if the current thread is a processing thread.

Definition at line 89 of file router.h.

◆ queue_control_port_change()

void Router::queue_control_port_change ( const ControlPort::ChangeEvent & change)

Queues a control port change to be applied when processing starts.

Currently only applies to BPM/time signature changes.

◆ recalc_graph()

void Router::recalc_graph ( bool soft)

Recalculates the process acyclic directed graph.

Parameters
softIf true, only readjusts latencies.

Field Documentation

◆ audio_engine_

AudioEngine* Router::audio_engine_ = nullptr

Definition at line 156 of file router.h.

◆ callback_in_progress_

bool Router::callback_in_progress_ = false

Definition at line 147 of file router.h.

◆ ctrl_port_change_queue_

RingBuffer<ControlPort::ChangeEvent> Router::ctrl_port_change_queue_ { 32 }

Message queue for control port changes, used for BPM/time signature changes.

Definition at line 154 of file router.h.

◆ global_offset_

nframes_t Router::global_offset_ = 0

Current global latency offset (max latency of all routes - remaining latency from engine).

Definition at line 142 of file router.h.

◆ graph_access_sem_

std::binary_semaphore Router::graph_access_sem_ { 1 }

Used when recalculating the graph.

Definition at line 145 of file router.h.

◆ graph_setup_in_progress_

std::atomic<bool> Router::graph_setup_in_progress_ = false

An atomic variable to check if the graph is currently being setup (so that we can avoid accessing buffers changed by this).

Definition at line 131 of file router.h.

◆ max_route_playback_latency_

nframes_t Router::max_route_playback_latency_ = 0

Stored for the currently processing cycle.

Definition at line 137 of file router.h.

◆ process_kickoff_thread_

unsigned int Router::process_kickoff_thread_ = 0

ID of the thread that calls kicks off the cycle.

Definition at line 150 of file router.h.

◆ scheduler_

std::unique_ptr<dsp::graph::GraphScheduler> Router::scheduler_

Definition at line 127 of file router.h.

◆ time_nfo_

EngineProcessTimeInfo Router::time_nfo_

Time info for this processing cycle.

Definition at line 134 of file router.h.


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