[][src]Trait quad_snd::SoundGenerator

pub trait SoundGenerator<T>: Send {
    pub fn init(&mut self, sample_rate: f32);
pub fn handle_event(&mut self, evt: T);
pub fn next_value(&mut self) -> f32; }

You must provide a struct implementing this trait to the driver.

This is what generates the samples to be send to the audio output.

Required methods

pub fn init(&mut self, sample_rate: f32)[src]

the sound driver calls this function during initialization to provide the audio interface sample rate.

pub fn handle_event(&mut self, evt: T)[src]

Because the sound generator runs in a separate thread on native target, you can only communicate with it through events using SoundDriver::send_event. This is where you should handle those events.

pub fn next_value(&mut self) -> f32[src]

This is the function generating the samples. Remember this is stereo output, you have to generate samples alternatively for the left and right channels. Sample values should be between -1.0 and 1.0.

Loading content...

Implementors

Loading content...