[−][src]Struct sdl2::mixer::Music
This is an opaque data type used for Music data.
Fields
raw: *mut Mix_Music
owned: bool
Methods
impl<'a> Music<'a>
[src]
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<Music<'static>, String>
[src]
Load music file to use.
pub fn from_static_bytes(buf: &'static [u8]) -> Result<Music<'static>, String>
[src]
Load music from a static byte buffer.
pub fn get_type(&self) -> MusicType
[src]
The file format encoding of the music.
pub fn play(&self, loops: i32) -> Result<(), String>
[src]
Play the loaded music loop times through from start to finish. Pass -1 to loop forever.
pub fn fade_in(&self, loops: i32, ms: i32) -> Result<(), String>
[src]
Fade in over ms milliseconds of time, the loaded music, playing it loop times through from start to finish.
pub fn fade_in_from_pos(
&self,
loops: i32,
ms: i32,
position: f64
) -> Result<(), String>
[src]
&self,
loops: i32,
ms: i32,
position: f64
) -> Result<(), String>
Fade in over ms milliseconds of time, from position.
pub fn get_volume() -> i32
[src]
Returns current volume
pub fn set_volume(volume: i32)
[src]
Set the volume on a scale of 0 to 128. Values greater than 128 will use 128.
pub fn pause()
[src]
Pause the music playback.
pub fn resume()
[src]
Unpause the music.
pub fn rewind()
[src]
Rewind the music to the start.
pub fn set_pos(position: f64) -> Result<(), String>
[src]
Set the position of the currently playing music.
pub fn set_command(command: &str) -> Result<(), String>
[src]
Setup a command line music player to use to play music.
pub fn halt()
[src]
Halt playback of music.
pub fn fade_out(ms: i32) -> Result<(), String>
[src]
Gradually fade out the music over ms milliseconds starting from now.
pub fn hook_finished(f: fn())
[src]
Sets up a function to be called when music playback is halted.
Examples
fn after_music() { println!("Music has ended"); } sdl2::mixer::Music::hook_finished(after_music);
pub fn unhook_finished()
[src]
A previously set up function would no longer be called when music playback is halted.
pub fn is_playing() -> bool
[src]
If music is actively playing, or not.
pub fn is_paused() -> bool
[src]
If music is paused, or not.
pub fn get_fading() -> Fading
[src]
If music is fading, or not.
Trait Implementations
impl<'a> Debug for Music<'a>
[src]
impl<'a> Drop for Music<'a>
[src]
impl<'a> PartialEq<Music<'a>> for Music<'a>
[src]
impl<'a> StructuralPartialEq for Music<'a>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Music<'a>
impl<'a> !Send for Music<'a>
impl<'a> !Sync for Music<'a>
impl<'a> Unpin for Music<'a>
impl<'a> UnwindSafe for Music<'a>
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,
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.
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>,