Expand description
Generic DSP engine that pairs a DspGraph implementation with a
Runtime, handling graph mounting, parameter diffing, and audio
processing.
§Usage
- Implement
DspGraphfor your graph — a pure function that buildsVec<Node>from parameters. - Create an
Engineat activation time. - Call
Engine::set_paramson parameter changes — the engine auto-discovers keyed consts and native node props from the graph and emits only the minimal update batches. - Call
Engine::processon every audio block.
§Example
ⓘ
use elemaudio_rs::{el, extra, Node};
use elemaudio_rs::engine::{DspGraph, Engine};
use serde_json::json;
struct MyDelay;
impl DspGraph for MyDelay {
type Params = f64; // just delay_ms for this example
fn build(params: &f64) -> Vec<Node> {
let delay = el::const_with_key("delay", *params);
let fb = el::const_(0.3);
let input = el::r#in(json!({"channel": 0}), None);
vec![extra::stride_delay(json!({"maxDelayMs": 1500}), delay, fb, input)]
}
}
let engine = Engine::<MyDelay>::new(44100.0, 512, &250.0).unwrap();Structs§
- Engine
- Generic DSP engine that owns a
Runtimeand a mounted graph. - Keyed
Const - A keyed const declaration (legacy — auto-discovered by engine).
- Native
Prop - A native node property declaration (legacy — auto-discovered by engine).
Traits§
- DspGraph
- A pure graph-building function.