pub struct SoundBank { /* private fields */ }Expand description
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: AudioPlayerRef, specs: &[SoundSpec<'_>]) -> SoundBank
pub fn load(player: AudioPlayerRef, 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) -> AudioPlayerRef
pub fn player(&self) -> AudioPlayerRef
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.