pub struct SoundBank { /* private fields */ }Expand description
Re-export framework services (HTTP, URI, etc.) from the dedicated services crate. A set of cues loaded once and kept alive for as long as the composable that remembered it stays in the composition.
Indexing is positional, so an app’s cue enum casts straight to an index;
SoundBank::find covers the cases where a name is more convenient. The
clips are released when the last clone drops.
Implementations§
Source§impl SoundBank
impl SoundBank
Sourcepub fn load(player: Arc<dyn AudioPlayer>, specs: &[SoundSpec<'_>]) -> SoundBank
pub fn load(player: Arc<dyn AudioPlayer>, specs: &[SoundSpec<'_>]) -> SoundBank
Loads every spec through player, collecting the ones that fail rather
than aborting the whole bank.
Sourcepub fn entries(&self) -> &[SoundBankEntry]
pub fn entries(&self) -> &[SoundBankEntry]
The cues, in spec order.
Sourcepub fn failures(&self) -> &[SoundBankFailure]
pub fn failures(&self) -> &[SoundBankFailure]
The cues that failed to load.
Sourcepub fn player(&self) -> Arc<dyn AudioPlayer> ⓘ
pub fn player(&self) -> Arc<dyn AudioPlayer> ⓘ
The player the bank loaded through.
Sourcepub fn id(&self, index: usize) -> SoundId
pub fn id(&self, index: usize) -> SoundId
The handle at index, or SoundId::NONE when out of range.
Sourcepub fn play_with(&self, index: usize, params: PlaybackParams)
pub fn play_with(&self, index: usize, params: PlaybackParams)
Plays a cue, multiplying params.volume by the cue’s own level. The
bus comes from the spec, so a cue cannot escape its bus by accident.
Sourcepub fn play_named(&self, name: &str, params: PlaybackParams)
pub fn play_named(&self, name: &str, params: PlaybackParams)
Plays the cue called name, if the bank holds it.
Sourcepub fn play_loop(&self, index: usize, params: PlaybackParams) -> VoiceId
pub fn play_loop(&self, index: usize, params: PlaybackParams) -> VoiceId
Starts a looping voice for a cue.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SoundBank
impl !Send for SoundBank
impl !Sync for SoundBank
impl !UnwindSafe for SoundBank
impl Freeze for SoundBank
impl Unpin for SoundBank
impl UnsafeUnpin for SoundBank
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.