Skip to main content

into_node

Function into_node 

Source
pub fn into_node<T>(node: T) -> Box<dyn DspNode>
where T: DspProcess + AetherNodeMeta + 'static,
Expand description

Convenience function: wrap any DspProcess + AetherNodeMeta into a boxed DspNode ready for the graph.

Examples found in repository?
examples/tremolo.rs (line 49)
39fn main() {
40    // Demonstrate that the macro generated Default, param_defs, and type_name.
41    let t = Tremolo::default();
42    println!("Node type:  {}", Tremolo::type_name());
43    println!("Param count: {}", Tremolo::PARAM_COUNT);
44    for def in Tremolo::param_defs() {
45        println!("  {} [{:.1}–{:.1}] default={:.2}", def.name, def.min, def.max, def.default);
46    }
47
48    // Wrap it for the engine
49    let _boxed: Box<dyn aether_ndk::DspNode> = into_node(t);
50    println!("\nNode wrapped and ready for the graph ✓");
51}
More examples
Hide additional examples
examples/simple_gain.rs (line 64)
43fn main() {
44    println!("AetherDSP NDK - Simple Gain Example");
45    println!("====================================\n");
46
47    // The #[aether_node] macro generated:
48    // - Default impl (using parameter defaults)
49    // - AetherNodeMeta trait (type_name, param_defs)
50    // - PARAM_COUNT constant
51
52    let gain = SimpleGain::default();
53
54    println!("✓ Created {} node", SimpleGain::type_name());
55    println!("✓ Parameter count: {}", SimpleGain::PARAM_COUNT);
56    println!("\nParameters:");
57
58    for def in SimpleGain::param_defs() {
59        println!("  • {} [{:.1}–{:.1}] default={:.2}",
60            def.name, def.min, def.max, def.default);
61    }
62
63    // Wrap for use in the engine
64    let _boxed: Box<dyn aether_ndk::DspNode> = into_node(gain);
65
66    println!("\n✓ Node wrapped and ready for the graph!");
67    println!("\n💡 This node can now be:");
68    println!("  • Added to an AudioGraph");
69    println!("  • Connected to other nodes");
70    println!("  • Controlled via parameters");
71    println!("  • Processed in real-time");
72}