Struct bevy_kira_audio::DynamicAudioChannels
source · pub struct DynamicAudioChannels { /* private fields */ }
Expand description
Resource to play and control audio in dynamic channels
You should only use this if you need a number of audio channels that is not known at compile time. If that is not the case, typed channels are easier to use with Bevy’s ECS.
Implementations§
source§impl DynamicAudioChannels
impl DynamicAudioChannels
sourcepub fn create_channel(&mut self, key: &str) -> &DynamicAudioChannel
pub fn create_channel(&mut self, key: &str) -> &DynamicAudioChannel
Creates and returns an audio channel for the given key
If there already is a channel with the given key, it will be stopped and removed.
sourcepub fn remove_channel(&mut self, key: &str)
pub fn remove_channel(&mut self, key: &str)
Remove the channel behind the given key
All audio in the channel will be stopped before it is removed. This method will do nothing if there is no channel for the given key.
sourcepub fn is_channel(&self, key: &str) -> bool
pub fn is_channel(&self, key: &str) -> bool
Checks if there is a channel available for the given key.
sourcepub fn channel(&self, key: &str) -> &DynamicAudioChannel
pub fn channel(&self, key: &str) -> &DynamicAudioChannel
Get a channel to play and control audio in
Panics
This method will panic if there is no channel for the given key.
If you aren’t sure that there is one, you can check with is_channel
,
or use get_channel
instead.
sourcepub fn get_channel(&self, key: &str) -> Option<&DynamicAudioChannel>
pub fn get_channel(&self, key: &str) -> Option<&DynamicAudioChannel>
Get a channel to play and control audio in
sourcepub fn iter(&self) -> Iter<'_, String, DynamicAudioChannel>
pub fn iter(&self) -> Iter<'_, String, DynamicAudioChannel>
An iterator over the keys and dynamic audio channels
Trait Implementations§
source§impl Default for DynamicAudioChannels
impl Default for DynamicAudioChannels
source§fn default() -> DynamicAudioChannels
fn default() -> DynamicAudioChannels
impl Resource for DynamicAudioChannels
Auto Trait Implementations§
impl !RefUnwindSafe for DynamicAudioChannels
impl Send for DynamicAudioChannels
impl Sync for DynamicAudioChannels
impl Unpin for DynamicAudioChannels
impl !UnwindSafe for DynamicAudioChannels
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given [World
].