9#include "dsp/graph_node.h"
10#include "dsp/parameter.h"
11#include "dsp/port_all.h"
26 struct BaseProcessingCache
31 std::vector<dsp::ProcessorParameter *> live_params_;
32 std::vector<dsp::PortPtrVariant> live_input_ports_;
33 std::vector<dsp::PortPtrVariant> live_output_ports_;
39 dsp::PortRegistry &port_registry_;
54 void add_input_port (
const dsp::PortUuidReference &uuid);
55 void add_output_port (
const dsp::PortUuidReference &uuid);
56 void add_parameter (
const dsp::ProcessorParameterUuidReference &uuid);
58 auto &get_input_ports ()
const {
return input_ports_; }
59 auto &get_output_ports ()
const {
return output_ports_; }
60 auto &get_parameters ()
const {
return params_; }
94 const dsp::
ITransport &transport) noexcept [[clang::nonblocking]];
96 virtual
void custom_prepare_for_processing (
102 virtual void custom_release_resources () { }
104 auto dependencies ()
const {
return dependencies_; }
107 static constexpr auto kProcessorNameKey =
"processorName"sv;
108 static constexpr auto kInputPortsKey =
"inputPorts"sv;
109 static constexpr auto kOutputPortsKey =
"outputPorts"sv;
110 static constexpr auto kParametersKey =
"parameters"sv;
111 friend void to_json (nlohmann::json &j,
const ProcessorBase &p);
112 friend void from_json (
const nlohmann::json &j, ProcessorBase &p);
115 ProcessorBaseDependencies dependencies_;
116 utils::Utf8String name_;
117 std::vector<dsp::PortUuidReference> input_ports_;
118 std::vector<dsp::PortUuidReference> output_ports_;
119 std::vector<dsp::ProcessorParameterUuidReference> params_;
122 std::unique_ptr<BaseProcessingCache> processing_caches_;
124 BOOST_DESCRIBE_CLASS (ProcessorBase, (), (), (), (name_))
A base class for processors in the DSP graph.
void process_block(EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport) noexcept final
Calls custom_process_block() internally after processing all the parameters.
void release_resources() final
Called to release resources allocated by prepare_for_processing().
void prepare_for_processing(sample_rate_t sample_rate, nframes_t max_block_length) final
Called to allocate resources required for processing.
void set_name(const utils::Utf8String &name)
Set a custom name to be used in the DSP graph.
virtual void custom_process_block(EngineProcessTimeInfo time_nfo, const dsp::ITransport &transport) noexcept
Custom processor logic after processing all owned parameters.
utils::Utf8String get_node_name() const final
Returns a human friendly name of the node.
Helper class to insert nodes and connections pertaining to a ProcessorBase instance to a graph.
Wrapper over a Uuid registry that provides (slow) lookup by unique ID.
The Graph class represents a graph of DSP nodes.
Interface for objects that can be processed in the DSP graph.
Lightweight UTF-8 string wrapper with safe conversions.
uint32_t sample_rate_t
Sample rate.
uint32_t nframes_t
Frame count.
Common struct to pass around during processing to avoid repeating the data in function arguments.