Skip to main content

AudioNode

Trait AudioNode 

Source
pub trait AudioNode: Send + Sync {
    // Required methods
    fn process(&mut self, inputs: &[&[f64]], output: &mut [f64], frames: usize);
    fn node_id(&self) -> NodeId;
    fn kind(&self) -> NodeKind;

    // Provided method
    fn channels(&self) -> usize { ... }
}
Expand description

Trait for any audio-processing node in the graph.

All processing is f64 internally. Conversion to f32 happens only at the hardware output boundary.

Required Methods§

Source

fn process(&mut self, inputs: &[&[f64]], output: &mut [f64], frames: usize)

Process frames of audio. inputs contains one buffer per incoming edge (may be empty for source nodes). Write output into output. Both are interleaved stereo f64.

Source

fn node_id(&self) -> NodeId

The node’s unique ID.

Source

fn kind(&self) -> NodeKind

What kind of node this is.

Provided Methods§

Source

fn channels(&self) -> usize

Number of output channels (default: 2 for stereo).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§