dsp-chain 0.5.0

Provides a Node trait and a Graph type for chaining together audio generators/processors in a dsp graph.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

use sound_stream::{Sample, Settings};


/// Types to be used as a **Node** within the DSP **Graph**.
pub trait Node<S> where S: Sample {
    /// Request audio from the **Node** given some stream format **Settings**.
    /// If the **Node** has no inputs, the `buffer` will be zeroed.
    /// If the **Node** has some inputs, the `buffer` will consist of the inputs summed together.
    ///
    /// Any source/generator type nodes should simply render straight to the buffer.
    /// Any effects/processor type nodes should mutate the buffer directly.
    fn audio_requested(&mut self, buffer: &mut [S], settings: Settings);
}