|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
Fixed-capacity source-to-target router with per-route depth/smoothing. More...
#include <ModulationRouter.h>
Public Member Functions | |
| int | addRoute (std::function< T()> source, std::function< void(T)> target, T depth=T(1), T base=T(0), T smoothMs=T(20)) |
| Adds a route (call from setup/UI threads, not the audio callback). | |
| void | setDepth (int route, T depth) noexcept |
| Changes a route's depth. Thread-safe (atomic, relaxed). | |
| void | clear () noexcept |
| Removes all routes and releases their captures (setup threads only). | |
| int | getNumRoutes () const noexcept |
| Number of configured routes. | |
| void | update (int numSamples, double sampleRate) noexcept |
| Evaluates every route once. Call per audio block. | |
Fixed-capacity source-to-target router with per-route depth/smoothing.
Threading: addRoute()/clear() belong to setup threads and must not run concurrently with update() (same contract as prepare() elsewhere in the framework). setDepth() is safe from any thread (atomic). update() runs on the audio thread and is noexcept: the stored callables MUST NOT throw – DSPark setters never do.
| T | Value type (float or double). |
| MaxRoutes | Route capacity (compile-time, no audio-thread allocation). |
Definition at line 57 of file ModulationRouter.h.
|
inline |
Adds a route (call from setup/UI threads, not the audio callback).
The applied value is base + source() * depth, one-pole smoothed.
| source | Returns the current modulation value. Must be non-empty. |
| target | Receives the smoothed, scaled value (a setter). Must be non-empty. |
| depth | Multiplier on the source value. |
| base | Constant offset. |
| smoothMs | One-pole smoothing time (0 = none). |
Definition at line 73 of file ModulationRouter.h.
|
inlinenoexcept |
Removes all routes and releases their captures (setup threads only).
Definition at line 98 of file ModulationRouter.h.
|
inlinenoexcept |
Number of configured routes.
Definition at line 109 of file ModulationRouter.h.
|
inlinenoexcept |
Changes a route's depth. Thread-safe (atomic, relaxed).
Definition at line 91 of file ModulationRouter.h.
|
inlinenoexcept |
Evaluates every route once. Call per audio block.
| numSamples | Samples in the block (drives the smoothing rate). |
| sampleRate | Current sample rate in Hz. |
Definition at line 116 of file ModulationRouter.h.