pub struct Music { /* private fields */ }
Expand description
Music, audio stream, anything longer than ~10 seconds should be streamed
Implementations§
Source§impl Music
impl Music
Sourcepub fn frame_count(&self) -> u32
pub fn frame_count(&self) -> u32
Total number of frames (considering channels)
Sourcepub fn set_looping(&mut self, looping: bool)
pub fn set_looping(&mut self, looping: bool)
Enable/disable looping
Sourcepub fn from_memory(data: &[u8], format: AudioFormat) -> Option<Self>
pub fn from_memory(data: &[u8], format: AudioFormat) -> Option<Self>
Load music stream from data
Sourcepub fn play(&self, _device: &mut AudioDevice)
pub fn play(&self, _device: &mut AudioDevice)
Start music playing
Sourcepub fn is_playing(&self, _device: &mut AudioDevice) -> bool
pub fn is_playing(&self, _device: &mut AudioDevice) -> bool
Check if music is playing
Sourcepub fn update(&self, _device: &mut AudioDevice)
pub fn update(&self, _device: &mut AudioDevice)
Updates buffers for music streaming
Sourcepub fn stop(&self, _device: &mut AudioDevice)
pub fn stop(&self, _device: &mut AudioDevice)
Stop music playing
Sourcepub fn pause(&self, _device: &mut AudioDevice)
pub fn pause(&self, _device: &mut AudioDevice)
Pause music playing
Sourcepub fn resume(&self, _device: &mut AudioDevice)
pub fn resume(&self, _device: &mut AudioDevice)
Resume playing paused music
Sourcepub fn seek(&self, position: Duration, _device: &mut AudioDevice)
pub fn seek(&self, position: Duration, _device: &mut AudioDevice)
Seek music to a position
Sourcepub fn set_volume(&self, volume: f32, _device: &mut AudioDevice)
pub fn set_volume(&self, volume: f32, _device: &mut AudioDevice)
Set volume for music (1.0 is max level)
Sourcepub fn set_pitch(&self, pitch: f32, _device: &mut AudioDevice)
pub fn set_pitch(&self, pitch: f32, _device: &mut AudioDevice)
Set pitch for a music (1.0 is base level)
Sourcepub fn set_pan(&self, pan: f32, _device: &mut AudioDevice)
pub fn set_pan(&self, pan: f32, _device: &mut AudioDevice)
Set pan for a music (0.5 is center)
Sourcepub fn get_time_length(&self, _device: &mut AudioDevice) -> Duration
pub fn get_time_length(&self, _device: &mut AudioDevice) -> Duration
Get music time length
Sourcepub fn get_time_played(&self, _device: &mut AudioDevice) -> Duration
pub fn get_time_played(&self, _device: &mut AudioDevice) -> Duration
Get current music time played
Sourcepub fn as_raw(&self) -> &Music
pub fn as_raw(&self) -> &Music
Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original
Sourcepub fn as_raw_mut(&mut self) -> &mut Music
pub fn as_raw_mut(&mut self) -> &mut Music
Get the ‘raw’ ffi type Take caution when cloning so it doesn’t outlive the original
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Music
impl RefUnwindSafe for Music
impl !Send for Music
impl !Sync for Music
impl Unpin for Music
impl UnwindSafe for Music
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