AudioGenerator

Trait AudioGenerator 

Source
pub trait AudioGenerator {
    // Required method
    fn process(&mut self, frames: &mut [[f32; 2]]);

    // Provided methods
    fn init(&mut self, _process_chunk_size: usize) { ... }
    fn process_midi(&mut self, _message: &[u8], _timestamp: u64) { ... }
}
Expand description

Trait to be implemented by structs that are passed as generator to the shell.

Required Methods§

Source

fn process(&mut self, frames: &mut [[f32; 2]])

Generates a chunk of samples.

  • frames is a buffer of process_chunk_size elements. It is initialized to [0.0; 2] and must be filled with sample data. Index 0 of each element is the left channel, index 1 the right channel.

Provided Methods§

Source

fn init(&mut self, _process_chunk_size: usize)

Initializes the generator. Called once on invocation.

  • process_chunk_size is the number of frames passed to the process function.
Source

fn process_midi(&mut self, _message: &[u8], _timestamp: u64)

Processes a MIDI message.

Implementors§