Struct sdl2_mixer::Music
[−]
[src]
pub struct Music { pub raw: *mut c_void, pub owned: bool, }
This is an opaque data type used for Music data.
Fields
raw: *mut c_void
owned: bool
Methods
impl Music
[src]
fn from_file(path: &Path) -> Result<Music, String>
Load music file to use.
fn get_type(&self) -> MusicType
The file format encoding of the music.
fn play(&self, loops: isize) -> Result<(), String>
Play the loaded music loop times through from start to finish.
fn fade_in(&self, loops: isize, ms: isize) -> Result<(), String>
Fade in over ms milliseconds of time, the loaded music, playing it loop times through from start to finish.
fn fade_in_from_pos(&self, loops: isize, ms: isize, position: f64) -> Result<(), String>
Fade in over ms milliseconds of time, from position.
fn get_volume() -> isize
Returns current volume
fn set_volume(volume: isize)
Set the volume on a scale of 0 to 128. Values greater than 128 will use 128.
fn pause()
Pause the music playback.
fn resume()
Unpause the music.
fn rewind()
Rewind the music to the start.
fn set_pos(position: f64) -> Result<(), String>
Set the position of the currently playing music.
fn set_command(command: &str) -> Result<(), String>
Setup a command line music player to use to play music.
fn halt()
Halt playback of music.
fn fade_out(ms: isize) -> Result<(), String>
Gradually fade out the music over ms milliseconds starting from now.
fn hook_finished(f: fn())
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);Run
fn unhook_finished()
A previously set up function would no longer be called when music playback is halted.
fn is_playing() -> bool
If music is actively playing, or not.
fn is_paused() -> bool
If music is paused, or not.
fn get_fading() -> Fading
If music is fading, or not.
Trait Implementations
impl PartialEq for Music
[src]
fn eq(&self, __arg_0: &Music) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Music) -> bool
This method tests for !=
.