pub struct AudioClip { /* private fields */ }Expand description
An audio clip wrapping a decoded AudioBuffer with playback control.
Implementations§
Source§impl AudioClip
Implements playback control for AudioClip.
impl AudioClip
Implements playback control for AudioClip.
Sourcepub fn create(buffer: AudioBuffer, name: String) -> AudioClip
pub fn create(buffer: AudioBuffer, name: String) -> AudioClip
Sourcepub fn play(&mut self, audio_context: &GameAudioContext)
pub fn play(&mut self, audio_context: &GameAudioContext)
Plays this clip through the given audio context.
Creates a new AudioBufferSourceNode, connects it through a gain node
to the master gain, and starts playback. If already playing, does nothing.
§Arguments
&GameAudioContext- The audio context to play through.
Sourcepub fn update_looping(&mut self, looping: bool)
pub fn update_looping(&mut self, looping: bool)
Sourcepub fn update_volume(&mut self, volume: f64)
pub fn update_volume(&mut self, volume: f64)
Sourcepub fn update_playback_rate(&mut self, rate: f64)
pub fn update_playback_rate(&mut self, rate: f64)
Sourcepub fn channel_count(&self) -> u32
pub fn channel_count(&self) -> u32
Source§impl AudioClip
impl AudioClip
pub fn get_mut_buffer(&mut self) -> &mut AudioBuffer
pub fn get_mut_name(&mut self) -> &mut String
pub fn get_state(&self) -> AudioPlayState
pub fn set_state(&mut self, val: AudioPlayState) -> &mut Self
pub fn get_looping(&self) -> bool
pub fn set_looping(&mut self, val: bool) -> &mut Self
pub fn get_volume(&self) -> f64
pub fn set_volume(&mut self, val: f64) -> &mut Self
pub fn get_playback_rate(&self) -> f64
pub fn set_playback_rate(&mut self, val: f64) -> &mut Self
pub fn get_source_node(&self) -> AudioBufferSourceNode
pub fn try_get_source_node(&self) -> &Option<AudioBufferSourceNode>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AudioClip
impl RefUnwindSafe for AudioClip
impl Send for AudioClip
impl Sync for AudioClip
impl Unpin for AudioClip
impl UnsafeUnpin for AudioClip
impl UnwindSafe for AudioClip
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
Mutably borrows from an owned value. Read more