aetherdsp-ndk 0.1.2

Node Development Kit for AetherDSP — build custom real-time DSP nodes with a single #[aether_node] macro
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Parameter utilities for node authors.

use aether_core::param::ParamBlock;
use crate::ParamDef;

/// Initialize a `ParamBlock` from a slice of `ParamDef`s.
/// Called automatically by the engine when a node is added to the graph.
pub fn init_params(block: &mut ParamBlock, defs: &[ParamDef]) {
    for def in defs {
        block.add(def.default);
    }
}

/// Clamp a param value to its defined range.
pub fn clamp_param(value: f32, def: &ParamDef) -> f32 {
    value.clamp(def.min, def.max)
}