use crate::{
    config::Config,
    node::{DynNode, LegatoNode},
    ports::PortBuilder,
    runtime::{Runtime, build_runtime},
};

pub fn get_node_test_harness_stereo_4096(node: Box<dyn DynNode>) -> Runtime {
    let config = Config {
        sample_rate: 48_000,
        block_size: 4096,
        channels: 2,
        initial_graph_capacity: 1,
    };

    let ports = PortBuilder::default().audio_out(2).build();

    let mut runtime = build_runtime(config, ports);

    let id = runtime.add_node(LegatoNode::new("test node".into(), "test".into(), node));

    let _ = runtime.set_sink_key(id);

    runtime.prepare();

    runtime
}

pub fn get_node_test_harness_stereo(
    node: Box<dyn DynNode>,
    sr: usize,
    block_size: usize,
) -> Runtime {
    let config = Config {
        sample_rate: sr,
        block_size,
        channels: 2,
        initial_graph_capacity: 1,
    };

    let ports = PortBuilder::default().audio_out(2).build();

    let mut runtime = build_runtime(config, ports);

    let id = runtime.add_node(LegatoNode::new("test node".into(), "test".into(), node));

    let _ = runtime.set_sink_key(id);

    runtime.prepare();

    runtime
}
