Struct bevy_retrograde::audio::kira::manager::AudioManager [−]
pub struct AudioManager { /* fields omitted */ }
Expand description
Plays and manages audio.
The audio manager is responsible for all communication between the gameplay thread and the audio thread.
Implementations
impl AudioManager
impl AudioManager
pub fn new(settings: AudioManagerSettings) -> Result<AudioManager, SetupError>
pub fn new(settings: AudioManagerSettings) -> Result<AudioManager, SetupError>
Creates a new audio manager and starts an audio thread.
pub fn add_sound(&mut self, sound: Sound) -> Result<SoundHandle, AddSoundError>
pub fn add_sound(&mut self, sound: Sound) -> Result<SoundHandle, AddSoundError>
Sends a sound to the audio thread and returns a handle to the sound.
pub fn load_sound(
&mut self,
path: impl AsRef<Path>,
settings: SoundSettings
) -> Result<SoundHandle, LoadSoundError>
pub fn load_sound(
&mut self,
path: impl AsRef<Path>,
settings: SoundSettings
) -> Result<SoundHandle, LoadSoundError>
Loads a sound from a file and returns a handle to the sound.
This is a shortcut for constructing the sound manually and adding it
using AudioManager::add_sound
.
pub fn remove_sound(
&mut self,
id: impl Into<SoundId>
) -> Result<(), RemoveSoundError>
pub fn remove_sound(
&mut self,
id: impl Into<SoundId>
) -> Result<(), RemoveSoundError>
Removes a sound from the audio thread.
pub fn add_arrangement(
&mut self,
arrangement: Arrangement
) -> Result<ArrangementHandle, AddArrangementError>
pub fn add_arrangement(
&mut self,
arrangement: Arrangement
) -> Result<ArrangementHandle, AddArrangementError>
Sends a arrangement to the audio thread and returns a handle to the arrangement.
pub fn remove_arrangement(
&mut self,
id: impl Into<ArrangementId>
) -> Result<(), RemoveArrangementError>
pub fn remove_arrangement(
&mut self,
id: impl Into<ArrangementId>
) -> Result<(), RemoveArrangementError>
Removes an arrangement from the audio thread.
pub fn add_metronome(
&mut self,
settings: MetronomeSettings
) -> Result<MetronomeHandle, AddMetronomeError>
pub fn add_metronome(
&mut self,
settings: MetronomeSettings
) -> Result<MetronomeHandle, AddMetronomeError>
Adds a metronome and returns a handle to it.
pub fn remove_metronome(
&mut self,
id: impl Into<MetronomeId>
) -> Result<(), RemoveMetronomeError>
pub fn remove_metronome(
&mut self,
id: impl Into<MetronomeId>
) -> Result<(), RemoveMetronomeError>
Removes a metronome from the audio thread.
pub fn start_sequence<CustomEvent>(
&mut self,
sequence: Sequence<CustomEvent>,
settings: SequenceInstanceSettings
) -> Result<SequenceInstanceHandle<CustomEvent>, StartSequenceError> where
CustomEvent: Clone + Eq + Hash,
pub fn start_sequence<CustomEvent>(
&mut self,
sequence: Sequence<CustomEvent>,
settings: SequenceInstanceSettings
) -> Result<SequenceInstanceHandle<CustomEvent>, StartSequenceError> where
CustomEvent: Clone + Eq + Hash,
Starts a sequence.
pub fn add_parameter(
&mut self,
settings: ParameterSettings
) -> Result<ParameterHandle, AddParameterError>
pub fn add_parameter(
&mut self,
settings: ParameterSettings
) -> Result<ParameterHandle, AddParameterError>
Creates a parameter with the specified starting value.
pub fn remove_parameter(
&mut self,
id: impl Into<ParameterId>
) -> Result<(), RemoveParameterError>
pub fn remove_parameter(
&mut self,
id: impl Into<ParameterId>
) -> Result<(), RemoveParameterError>
Removes a parameter from the audio thread.
pub fn main_track(&mut self) -> MainTrackHandle
pub fn main_track(&mut self) -> MainTrackHandle
Returns a handle to the main mixer track.
pub fn add_sub_track(
&mut self,
settings: SubTrackSettings
) -> Result<SubTrackHandle, AddSubTrackError>
pub fn add_sub_track(
&mut self,
settings: SubTrackSettings
) -> Result<SubTrackHandle, AddSubTrackError>
Creates a mixer sub-track.
pub fn remove_sub_track(
&mut self,
id: impl Into<SubTrackId>
) -> Result<(), RemoveSubTrackError>
pub fn remove_sub_track(
&mut self,
id: impl Into<SubTrackId>
) -> Result<(), RemoveSubTrackError>
Removes a sub-track from the mixer.
pub fn add_send_track(
&mut self,
settings: SendTrackSettings
) -> Result<SendTrackHandle, AddSendTrackError>
pub fn add_send_track(
&mut self,
settings: SendTrackSettings
) -> Result<SendTrackHandle, AddSendTrackError>
Creates a mixer send track.
pub fn remove_send_track(
&mut self,
id: impl Into<SendTrackId>
) -> Result<(), RemoveSendTrackError>
pub fn remove_send_track(
&mut self,
id: impl Into<SendTrackId>
) -> Result<(), RemoveSendTrackError>
Removes a send track from the mixer.
pub fn add_group(
&mut self,
settings: GroupSettings
) -> Result<GroupHandle, AddGroupError>
pub fn add_group(
&mut self,
settings: GroupSettings
) -> Result<GroupHandle, AddGroupError>
Adds a group.
pub fn remove_group(
&mut self,
id: impl Into<GroupId>
) -> Result<(), RemoveGroupError>
pub fn remove_group(
&mut self,
id: impl Into<GroupId>
) -> Result<(), RemoveGroupError>
Removes a group.
pub fn add_stream(
&mut self,
stream: impl AudioStream,
track: TrackIndex
) -> Result<AudioStreamId, AddStreamError>
pub fn add_stream(
&mut self,
stream: impl AudioStream,
track: TrackIndex
) -> Result<AudioStreamId, AddStreamError>
Adds an audio stream.
pub fn remove_stream(
&mut self,
id: AudioStreamId
) -> Result<(), RemoveStreamError>
pub fn remove_stream(
&mut self,
id: AudioStreamId
) -> Result<(), RemoveStreamError>
Removes an audio stream.
pub fn free_unused_resources(&mut self)
pub fn free_unused_resources(&mut self)
Frees resources that are no longer in use, such as unloaded sounds or finished sequences.
Trait Implementations
impl Drop for AudioManager
impl Drop for AudioManager
Auto Trait Implementations
impl !RefUnwindSafe for AudioManager
impl Send for AudioManager
impl !Sync for AudioManager
impl Unpin for AudioManager
impl !UnwindSafe for AudioManager
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert 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
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V