[−][src]Struct kira::manager::AudioManager
Plays and manages audio.
The audio manager is responsible for all communication between the gameplay thread and the audio thread.
Implementations
impl AudioManager
[src]
pub fn new(settings: AudioManagerSettings) -> AudioResult<Self>
[src]
Creates a new audio manager and starts an audio thread.
pub fn add_sound(&mut self, sound: Sound) -> AudioResult<SoundId>
[src]
Sends a sound to the audio thread and returns a handle to the sound.
pub fn load_sound<P: AsRef<Path>>(
&mut self,
path: P,
settings: PlayableSettings
) -> AudioResult<SoundId>
[src]
&mut self,
path: P,
settings: PlayableSettings
) -> AudioResult<SoundId>
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: SoundId) -> AudioResult<()>
[src]
Removes a sound from the audio thread, allowing its memory to be freed.
pub fn add_arrangement(
&mut self,
arrangement: Arrangement
) -> AudioResult<ArrangementId>
[src]
&mut self,
arrangement: Arrangement
) -> AudioResult<ArrangementId>
Sends a arrangement to the audio thread and returns a handle to the arrangement.
pub fn remove_arrangement(&mut self, id: ArrangementId) -> AudioResult<()>
[src]
Removes a arrangement from the audio thread, allowing its memory to be freed.
pub fn free_unused_resources(&mut self)
[src]
Frees resources that are no longer in use, such as unloaded sounds or finished sequences.
pub fn play<P: Into<Playable>>(
&mut self,
playable: P,
settings: InstanceSettings
) -> Result<InstanceId, AudioError>
[src]
&mut self,
playable: P,
settings: InstanceSettings
) -> Result<InstanceId, AudioError>
Plays a sound or arrangement.
pub fn set_instance_volume<V: Into<Value<f64>>>(
&mut self,
id: InstanceId,
volume: V
) -> Result<(), AudioError>
[src]
&mut self,
id: InstanceId,
volume: V
) -> Result<(), AudioError>
Sets the volume of an instance.
pub fn set_instance_pitch<V: Into<Value<f64>>>(
&mut self,
id: InstanceId,
pitch: V
) -> Result<(), AudioError>
[src]
&mut self,
id: InstanceId,
pitch: V
) -> Result<(), AudioError>
Sets the pitch of an instance.
pub fn set_instance_panning<V: Into<Value<f64>>>(
&mut self,
id: InstanceId,
panning: V
) -> Result<(), AudioError>
[src]
&mut self,
id: InstanceId,
panning: V
) -> Result<(), AudioError>
Sets the panning of an instance (0 = hard left, 1 = hard right).
pub fn seek_instance(
&mut self,
id: InstanceId,
offset: f64
) -> Result<(), AudioError>
[src]
&mut self,
id: InstanceId,
offset: f64
) -> Result<(), AudioError>
Moves the playback position of an instance backward or forward.
pub fn seek_instance_to(
&mut self,
id: InstanceId,
position: f64
) -> Result<(), AudioError>
[src]
&mut self,
id: InstanceId,
position: f64
) -> Result<(), AudioError>
Sets the playback position of an instance.
pub fn pause_instance(
&mut self,
instance_id: InstanceId,
settings: PauseInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
instance_id: InstanceId,
settings: PauseInstanceSettings
) -> Result<(), AudioError>
Pauses a currently playing instance of a sound with an optional fade-out tween.
pub fn resume_instance(
&mut self,
instance_id: InstanceId,
settings: ResumeInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
instance_id: InstanceId,
settings: ResumeInstanceSettings
) -> Result<(), AudioError>
Resumes a currently paused instance of a sound with an optional fade-in tween.
pub fn stop_instance(
&mut self,
instance_id: InstanceId,
settings: StopInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
instance_id: InstanceId,
settings: StopInstanceSettings
) -> Result<(), AudioError>
Stops a currently playing instance of a sound with an optional fade-out tween.
Once the instance is stopped, it cannot be restarted.
pub fn pause_instances_of(
&mut self,
playable: Playable,
settings: PauseInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
playable: Playable,
settings: PauseInstanceSettings
) -> Result<(), AudioError>
Pauses all currently playing instances of a sound or arrangement with an optional fade-out tween.
pub fn resume_instances_of(
&mut self,
playable: Playable,
settings: ResumeInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
playable: Playable,
settings: ResumeInstanceSettings
) -> Result<(), AudioError>
Resumes all currently playing instances of a sound or arrangement with an optional fade-in tween.
pub fn stop_instances_of(
&mut self,
playable: Playable,
settings: StopInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
playable: Playable,
settings: StopInstanceSettings
) -> Result<(), AudioError>
Stops all currently playing instances of a sound or arrangement with an optional fade-out tween.
pub fn set_metronome_tempo<T: Into<Value<Tempo>>>(
&mut self,
tempo: T
) -> Result<(), AudioError>
[src]
&mut self,
tempo: T
) -> Result<(), AudioError>
Sets the tempo of the metronome.
pub fn start_metronome(&mut self) -> Result<(), AudioError>
[src]
Starts or resumes the metronome.
pub fn pause_metronome(&mut self) -> Result<(), AudioError>
[src]
Pauses the metronome.
pub fn stop_metronome(&mut self) -> Result<(), AudioError>
[src]
Stops and resets the metronome.
pub fn start_sequence<CustomEvent: Clone + Eq + Hash>(
&mut self,
sequence: Sequence<CustomEvent>,
settings: SequenceInstanceSettings
) -> Result<(SequenceInstanceId, EventReceiver<CustomEvent>), AudioError>
[src]
&mut self,
sequence: Sequence<CustomEvent>,
settings: SequenceInstanceSettings
) -> Result<(SequenceInstanceId, EventReceiver<CustomEvent>), AudioError>
Starts a sequence.
pub fn mute_sequence(
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
[src]
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
Mutes a sequence.
When a sequence is muted, it will continue waiting for durations and intervals, but it will not play sounds, emit events, or perform any other actions.
pub fn unmute_sequence(
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
[src]
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
Unmutes a sequence.
pub fn pause_sequence(
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
[src]
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
Pauses a sequence.
pub fn resume_sequence(
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
[src]
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
Resumes a sequence.
pub fn stop_sequence(
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
[src]
&mut self,
id: SequenceInstanceId
) -> Result<(), AudioError>
Stops a sequence.
pub fn pause_sequence_and_instances(
&mut self,
id: SequenceInstanceId,
settings: PauseInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
id: SequenceInstanceId,
settings: PauseInstanceSettings
) -> Result<(), AudioError>
Pauses a sequence and any instances played by that sequence.
pub fn resume_sequence_and_instances(
&mut self,
id: SequenceInstanceId,
settings: ResumeInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
id: SequenceInstanceId,
settings: ResumeInstanceSettings
) -> Result<(), AudioError>
Resumes a sequence and any instances played by that sequence.
pub fn stop_sequence_and_instances(
&mut self,
id: SequenceInstanceId,
settings: StopInstanceSettings
) -> Result<(), AudioError>
[src]
&mut self,
id: SequenceInstanceId,
settings: StopInstanceSettings
) -> Result<(), AudioError>
Stops a sequence and any instances played by that sequence.
pub fn add_parameter(&mut self, value: f64) -> AudioResult<ParameterId>
[src]
Creates a parameter with the specified starting value.
pub fn remove_parameter(&mut self, id: ParameterId) -> AudioResult<()>
[src]
Removes a parameter.
pub fn set_parameter(
&mut self,
id: ParameterId,
value: f64,
tween: Option<Tween>
) -> AudioResult<()>
[src]
&mut self,
id: ParameterId,
value: f64,
tween: Option<Tween>
) -> AudioResult<()>
Sets the value of a parameter with an optional tween to smoothly change the value.
pub fn add_sub_track(
&mut self,
settings: TrackSettings
) -> AudioResult<SubTrackId>
[src]
&mut self,
settings: TrackSettings
) -> AudioResult<SubTrackId>
Creates a mixer sub-track.
pub fn remove_sub_track(&mut self, id: SubTrackId) -> AudioResult<()>
[src]
Removes a sub-track from the mixer.
pub fn add_effect_to_track<T: Into<TrackIndex> + Copy, E: Effect + 'static>(
&mut self,
track_index: T,
effect: E,
settings: EffectSettings
) -> AudioResult<EffectId>
[src]
&mut self,
track_index: T,
effect: E,
settings: EffectSettings
) -> AudioResult<EffectId>
Adds an effect to a track.
pub fn remove_effect(&mut self, effect_id: EffectId) -> AudioResult<()>
[src]
Removes an effect from the mixer.
pub fn add_stream<T: Into<TrackIndex>, S: AudioStream>(
&mut self,
track_index: T,
stream: S
) -> AudioResult<AudioStreamId>
[src]
&mut self,
track_index: T,
stream: S
) -> AudioResult<AudioStreamId>
Starts an audio stream on the specified track.
pub fn remove_stream(&mut self, stream_id: AudioStreamId) -> AudioResult<()>
[src]
Stops and drops the specified audio stream.
pub fn add_group<T: Into<Vec<GroupId>>>(
&mut self,
parent_groups: T
) -> AudioResult<GroupId>
[src]
&mut self,
parent_groups: T
) -> AudioResult<GroupId>
Adds a group.
pub fn remove_group(&mut self, id: GroupId) -> AudioResult<()>
[src]
Removes a group.
pub fn pause_group(
&mut self,
id: GroupId,
settings: PauseInstanceSettings
) -> AudioResult<()>
[src]
&mut self,
id: GroupId,
settings: PauseInstanceSettings
) -> AudioResult<()>
Pauses all instances of sounds, arrangements, and sequences in a group.
pub fn resume_group(
&mut self,
id: GroupId,
settings: ResumeInstanceSettings
) -> AudioResult<()>
[src]
&mut self,
id: GroupId,
settings: ResumeInstanceSettings
) -> AudioResult<()>
Resumes all instances of sounds, arrangements, and sequences in a group.
pub fn stop_group(
&mut self,
id: GroupId,
settings: StopInstanceSettings
) -> AudioResult<()>
[src]
&mut self,
id: GroupId,
settings: StopInstanceSettings
) -> AudioResult<()>
Stops all instances of sounds, arrangements, and sequences in a group.
pub fn pop_event(&mut self) -> Option<Event>
[src]
Pops an event that was sent by the audio thread.
Trait Implementations
impl Drop for AudioManager
[src]
Auto Trait Implementations
impl !RefUnwindSafe for AudioManager
[src]
impl !Send for AudioManager
[src]
impl !Sync for AudioManager
[src]
impl Unpin for AudioManager
[src]
impl !UnwindSafe for AudioManager
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,