[][src]Struct quad_snd::snd::SoundDriver

pub struct SoundDriver<T: Send + 'static> { /* fields omitted */ }

This is the sound API that allows you to send events to your generator.

Implementations

impl<T: Send + 'static> SoundDriver<T>[src]

pub fn get_error(&self) -> SoundError[src]

After calling SoundDriver::new, you can call this function to see if the audio initialization was a success.

pub fn new(generator: Box<dyn SoundGenerator<T>>) -> Self[src]

Initialize the sound device and provide the generator to the driver.

pub fn send_event(&mut self, event: T)[src]

Send an event to the generator

pub fn frame(&mut self)[src]

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]

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> !RefUnwindSafe for SoundDriver<T>[src]

impl<T> Send for SoundDriver<T>[src]

impl<T> !Sync for SoundDriver<T>[src]

impl<T> Unpin for SoundDriver<T>[src]

impl<T> !UnwindSafe for SoundDriver<T>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.