[][src]Trait bae_rs::sounds::Sound

pub trait Sound {
    fn toggle_pause(&mut self);
fn is_paused(&self) -> bool;
fn toggle_mute(&mut self);
fn is_muted(&self) -> bool;
fn process(&mut self, input: SampleT) -> SampleT;
fn register(&mut self, id: usize);
fn unregister(&mut self);
fn get_id(&self) -> Option<usize>; }

This trait defines the interface that anything producing sound that will be output to a Channel must define.

Required methods

fn toggle_pause(&mut self)

Toggles the pause state of the sound. If the sound is paused, the internal structures aren't process during a call to process, instead only Default::default() is returned.

fn is_paused(&self) -> bool

Returns the pause state of the sound.

fn toggle_mute(&mut self)

Toggels the mute state of the sound. If the sound is muted, the internal structures are still processed during a call to process, but Default::default() is returned.

fn is_muted(&self) -> bool

Returns the mute state of the sound.

fn process(&mut self, input: SampleT) -> SampleT

Processes the sound and its internal structures, returning the resulting audio sample.

If the sound is paused, no processing of the internal structures is performed, instead only Default::default() is returned.

If the sound is muted, the internal structures are still processed, but Default::default() is still returned.

fn register(&mut self, id: usize)

Sets itself as registered with the given ID.

Caution should be taken when registering and unregistering sounds to or from a Channel, as Sounds don't control their own registration. As such you should be registering through Channel::add_sound.

fn unregister(&mut self)

Sets itself as unregistered and clears the saved ID.

Caution should be taken when registering and unregistering sounds to or from a Channel as Sounds don't control their own registration. As such you should be registering through Channel::remove_sound.

fn get_id(&self) -> Option<usize>

Returns the ID given to the Sound during registration with a Channel. If the Sound is unregistered, it will return None.

Loading content...

Implementors

impl Sound for ComplexSound[src]

impl Sound for SimpleSound[src]

Loading content...