42 ProcessorRouter(
int num_inputs = 0,
int num_outputs = 0,
bool control_rate =
false);
70 virtual void process(
int num_samples)
override;
75 virtual void init()
override;
254 std::map<const Processor*, std::pair<int, std::unique_ptr<Processor>>>
processors_;
A generic circular buffer (FIFO) data structure that allows adding and removing elements efficiently.
Definition circular_queue.h:32
A processor that buffers and replays audio, providing a feedback loop mechanism.
Definition feedback.h:26
Base class for all signal-processing units in Vital.
Definition processor.h:212
virtual bool isPolyphonic() const
Checks if this Processor is polyphonic by querying its ProcessorRouter.
Definition processor.cpp:73
A specialized Processor that manages a directed graph of Processors and ensures correct processing or...
Definition processor_router.h:34
std::map< const Processor *, std::pair< int, std::unique_ptr< Feedback > > > feedback_processors_
Map of global to local Feedback processors.
Definition processor_router.h:259
virtual void updateAllProcessors()
Updates all processors to match the global order. Called when changes occur.
Definition processor_router.cpp:300
std::shared_ptr< CircularQueue< const Processor * > > dependencies_
Queue for dependencies calculations.
Definition processor_router.h:264
virtual Processor * clone() const override
Creates a copy of this ProcessorRouter.
Definition processor_router.h:59
int local_changes_
Local change counter to track synchronization with global changes.
Definition processor_router.h:262
virtual ~ProcessorRouter()
Destructor.
Definition processor_router.cpp:55
virtual void deleteRemovedProcessors()
Deletes any processors that were removed at the global level but not yet removed locally.
Definition processor_router.cpp:337
void disconnect(const Processor *destination, const Output *source)
Disconnects a source Output from a destination Processor.
Definition processor_router.cpp:182
virtual void removeProcessor(Processor *processor)
Removes a Processor from this router.
Definition processor_router.cpp:151
std::map< const Processor *, std::pair< int, std::unique_ptr< Processor > > > processors_
Map of global to local Processors.
Definition processor_router.h:254
virtual ProcessorRouter * getPolyRouter()
Gets the polyphonic router that corresponds to this ProcessorRouter.
Definition processor_router.cpp:269
ProcessorRouter(int num_inputs=0, int num_outputs=0, bool control_rate=false)
Constructs a ProcessorRouter with a specified number of inputs and outputs.
Definition processor_router.cpp:16
bool isDownstream(const Processor *first, const Processor *second) const
Checks if one Processor is downstream from another, i.e., if there's a path from the second to the fi...
Definition processor_router.cpp:233
std::shared_ptr< int > global_changes_
Global change counter.
Definition processor_router.h:261
virtual void setOversampleAmount(int oversample) override
Sets the oversampling amount for all Processors in this router.
Definition processor_router.cpp:104
virtual void addFeedback(Feedback *feedback)
Adds a Feedback node to handle a feedback loop introduced by a connection.
Definition processor_router.cpp:278
virtual void removeFeedback(Feedback *feedback)
Removes a previously added Feedback node.
Definition processor_router.cpp:285
virtual void init() override
Initializes the ProcessorRouter and all its Processors.
Definition processor_router.cpp:84
virtual ProcessorRouter * getMonoRouter()
Gets the mono router that corresponds to this ProcessorRouter.
Definition processor_router.cpp:263
virtual void setSampleRate(int sample_rate) override
Sets the sample rate for all Processors in this router.
Definition processor_router.cpp:90
std::shared_ptr< std::vector< const Feedback * > > global_feedback_order_
Global order of Feedback nodes.
Definition processor_router.h:257
std::shared_ptr< CircularQueue< Processor * > > global_order_
Global processing order reference.
Definition processor_router.h:250
std::vector< Feedback * > local_feedback_order_
Local copies of Feedback nodes.
Definition processor_router.h:258
virtual void createAddedProcessors()
Creates any processors that were added at the global level but not yet replicated locally.
Definition processor_router.cpp:309
virtual void addIdleProcessor(Processor *processor)
Adds a Processor that should remain idle (not processed) in the router.
Definition processor_router.cpp:146
bool areOrdered(const Processor *first, const Processor *second) const
Checks if the order of two Processors is fixed in the router's processing sequence.
Definition processor_router.cpp:238
std::shared_ptr< CircularQueue< const Processor * > > dependencies_visited_
Queue of visited processors for dependencies calc.
Definition processor_router.h:265
std::shared_ptr< CircularQueue< const Processor * > > dependency_inputs_
Queue of processors to check inputs for dependencies.
Definition processor_router.h:266
std::map< const Processor *, std::unique_ptr< Processor > > idle_processors_
Idle Processors that are not active in the graph.
Definition processor_router.h:255
virtual void resetFeedbacks(poly_mask reset_mask)
Resets all Feedback nodes within this router using a reset mask.
Definition processor_router.cpp:273
void reorder(Processor *processor)
Reorders the internal processing sequence to account for a Processor's dependencies.
Definition processor_router.cpp:197
force_inline bool shouldUpdate()
Checks if local changes need to be synchronized with global changes.
Definition processor_router.h:213
virtual void addProcessorRealTime(Processor *processor)
Adds a Processor to the router in real-time (no memory allocations).
Definition processor_router.cpp:129
void connect(Processor *destination, const Output *source, int index)
Connects a source Output to a destination Processor input by index.
Definition processor_router.cpp:168
CircularQueue< Processor * > local_order_
Local ordering of Processors.
Definition processor_router.h:252
std::shared_ptr< CircularQueue< Processor * > > global_reorder_
Temporary storage for reorder operations.
Definition processor_router.h:251
void getDependencies(const Processor *processor) const
Populates the internal dependencies structure for a given Processor.
Definition processor_router.cpp:380
virtual void process(int num_samples) override
Processes audio through all Processors managed by this router.
Definition processor_router.cpp:57
const Processor * getContext(const Processor *processor) const
Gets the processor context within this router for a global Processor reference.
Definition processor_router.cpp:366
Processor * getLocalProcessor(const Processor *global_processor)
Retrieves the local instance of a globally defined Processor.
Definition processor_router.cpp:376
virtual void addProcessor(Processor *processor)
Adds a Processor to be managed by this router.
Definition processor_router.cpp:121
#define force_inline
Definition common.h:23
Contains classes and functions used within the Vital synthesizer framework.
Declares the Processor class and related structures for handling audio processing in a polyphonic con...
Holds and manages a buffer of samples (poly_float) for a Processor's output.
Definition processor.h:35
Represents a vector of integer values using SIMD instructions.
Definition poly_values.h:56