Skip to main content

ActiveNode

Trait ActiveNode 

Source
pub trait ActiveNode<T: Transcendental, const BUF_SIZE: usize>: IoNode<T, BUF_SIZE> {
    // Required method
    fn run(
        &mut self,
        tick: Box<dyn FnMut(u64, f32)>,
        running: Arc<AtomicBool>,
    ) -> IoResult<()>;
}
Expand description

A node that drives graph processing through its audio backend.

The active node is the single node in a graph that hosts the audio callback loop. It receives a tick closure from [Graph] and registers it as the process callback on its backend.

Only one node per graph implements this trait — it must also implement IoNode.

Required Methods§

Source

fn run( &mut self, tick: Box<dyn FnMut(u64, f32)>, running: Arc<AtomicBool>, ) -> IoResult<()>

Run graph processing through this node’s audio backend.

The tick closure is called once per audio block with (sample_pos, sample_rate). The implementation must register it as a process callback on the backend and block until running becomes false.

Implementors§