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

A base class for processors in the DSP graph. More...

#include <src/dsp/processor_base.h>

Inheritance diagram for zrythm::dsp::ProcessorBase:
Collaboration diagram for zrythm::dsp::ProcessorBase:

Data Structures

struct  ProcessorBaseDependencies

Public Member Functions

 ProcessorBase (ProcessorBaseDependencies dependencies, utils::Utf8String name={ u8"ProcessorBase" })
void set_name (const utils::Utf8String &name)
 Set a custom name to be used in the DSP graph.
void add_input_port (const dsp::PortUuidReference &uuid)
void add_output_port (const dsp::PortUuidReference &uuid)
void add_parameter (const dsp::ProcessorParameterUuidReference &uuid)
auto & get_input_ports () const
auto & get_output_ports () const
auto & get_parameters () const
utils::Utf8String get_node_name () const final
 Returns a human friendly name of the node.
void process_block (EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport) noexcept final
 Calls custom_process_block() internally after processing all the parameters.
void prepare_for_processing (const graph::GraphNode *node, units::sample_rate_t sample_rate, nframes_t max_block_length) final
 Called to allocate resources required for processing.
void release_resources () final
 Called to release resources allocated by prepare_for_processing().
Public Member Functions inherited from zrythm::dsp::graph::IProcessable
virtual nframes_t get_single_playback_latency () const
 Returns the latency of only the given processable, without adding the previous/next latencies.

Protected Member Functions

virtual void custom_process_block (EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport) noexcept
 Custom processor logic after processing all owned parameters.
virtual void custom_prepare_for_processing (const graph::GraphNode *node, units::sample_rate_t sample_rate, nframes_t max_block_length)
virtual void custom_release_resources ()
auto dependencies () const

Friends

void to_json (nlohmann::json &j, const ProcessorBase &p)
void from_json (const nlohmann::json &j, ProcessorBase &p)

Detailed Description

A base class for processors in the DSP graph.

Note
Custom connections to processors should only be made on their output ports (because input ports are clared after processing processors).

Definition at line 24 of file processor_base.h.

Member Function Documentation

◆ custom_prepare_for_processing()

virtual void zrythm::dsp::ProcessorBase::custom_prepare_for_processing ( const graph::GraphNode * node,
units::sample_rate_t sample_rate,
nframes_t max_block_length )
inlineprotectedvirtual

Definition at line 97 of file processor_base.h.

◆ custom_process_block()

virtual void zrythm::dsp::ProcessorBase::custom_process_block ( EngineProcessTimeInfo time_nfo,
const dsp::ITransport & transport )
protectedvirtualnoexcept

◆ custom_release_resources()

virtual void zrythm::dsp::ProcessorBase::custom_release_resources ( )
inlineprotectedvirtual

Definition at line 104 of file processor_base.h.

◆ dependencies()

auto zrythm::dsp::ProcessorBase::dependencies ( ) const
inlineprotected

Definition at line 106 of file processor_base.h.

◆ get_input_ports()

auto & zrythm::dsp::ProcessorBase::get_input_ports ( ) const
inline

Definition at line 58 of file processor_base.h.

◆ get_node_name()

utils::Utf8String zrythm::dsp::ProcessorBase::get_node_name ( ) const
inlinefinalvirtual

Returns a human friendly name of the node.

Implements zrythm::dsp::graph::IProcessable.

Definition at line 66 of file processor_base.h.

◆ get_output_ports()

auto & zrythm::dsp::ProcessorBase::get_output_ports ( ) const
inline

Definition at line 59 of file processor_base.h.

◆ get_parameters()

auto & zrythm::dsp::ProcessorBase::get_parameters ( ) const
inline

Definition at line 60 of file processor_base.h.

◆ prepare_for_processing()

void zrythm::dsp::ProcessorBase::prepare_for_processing ( const graph::GraphNode * node,
units::sample_rate_t sample_rate,
nframes_t max_block_length )
finalvirtual

Called to allocate resources required for processing.

Parameters
nodeThe node in the processing graph. Null means we are processing outside of a graph context and must be handled gracefully.
sample_rate
max_block_length

Reimplemented from zrythm::dsp::graph::IProcessable.

◆ process_block()

void zrythm::dsp::ProcessorBase::process_block ( EngineProcessTimeInfo time_nfo,
const dsp::ITransport & transport )
finalvirtualnoexcept

Calls custom_process_block() internally after processing all the parameters.

This is done this way to make sure all parameters are processed by the owning processor as intended and to avoid mistakes by leaving it up to processor implementations to do.

Reimplemented from zrythm::dsp::graph::IProcessable.

◆ release_resources()

void zrythm::dsp::ProcessorBase::release_resources ( )
finalvirtual

Called to release resources allocated by prepare_for_processing().

This may be called multiple times.

Reimplemented from zrythm::dsp::graph::IProcessable.


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