1use auxide::graph::{Graph, NodeType, PortId, Rate};
3use auxide::plan::Plan;
4use auxide::rt::Runtime;
5use auxide_io::stream_controller::StreamController;
6
7fn main() -> anyhow::Result<()> {
8 let mut graph = Graph::new();
10 let osc = graph.add_node(NodeType::SineOsc { freq: 440.0 });
11 let sink = graph.add_node(NodeType::OutputSink);
12 graph
13 .add_edge(auxide::graph::Edge {
14 from_node: osc,
15 from_port: PortId(0),
16 to_node: sink,
17 to_port: PortId(0),
18 rate: Rate::Audio,
19 })
20 .unwrap();
21
22 let plan = Plan::compile(&graph, 512).unwrap();
23 let runtime = Runtime::new(plan, &graph, 192000.0);
24
25 let controller = StreamController::play(runtime)?;
27 controller.start()?;
28
29 println!("Playing 440Hz tone. Press Enter to stop...");
30 let mut input = String::new();
31 std::io::stdin().read_line(&mut input)?;
32
33 controller.stop();
34 println!("Stopped.");
35
36 Ok(())
37}