[−][src]Trait bae_rs::sounds::Sound
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 Sound
s 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 Sound
s don't control their own registration.
As such you should be registering through Channel::remove_sound
.