Struct uni_snd::snd::SoundDriver [−][src]
pub struct SoundDriver<T: Send + 'static> { /* fields omitted */ }
This is the sound API that allows you to send events to your generator.
Methods
impl<T: Send + 'static> SoundDriver<T>
[src]
impl<T: Send + 'static> SoundDriver<T>
pub fn get_error(&self) -> SoundError
[src]
pub fn get_error(&self) -> SoundError
After calling SoundDriver::new
, you can call this function to see if the audio initialization was a success.
pub fn new(generator: Box<SoundGenerator<T>>) -> Self
[src]
pub fn new(generator: Box<SoundGenerator<T>>) -> Self
Initialize the sound device and provide the generator to the driver.
pub fn send_event(&mut self, event: T)
[src]
pub fn send_event(&mut self, event: T)
Send an event to the generator
pub fn frame(&mut self)
[src]
pub fn frame(&mut self)
This function should be called every frame. It's only needed on web target to fill the output sound buffer.
pub fn start(&mut self)
[src]
pub fn start(&mut self)
This will call the generator init function.
On native target, it starts the sound thread and the audio loop.
On web target, only the SoundDriver::frame
function produces sound.
Auto Trait Implementations
impl<T> Send for SoundDriver<T>
impl<T> Send for SoundDriver<T>
impl<T> !Sync for SoundDriver<T>
impl<T> !Sync for SoundDriver<T>