Struct nitro::audio::Playlist
[−]
[src]
pub struct Playlist { pub shuffle: bool, pub loop_music: bool, // some fields omitted }
Allows you to create and control playlists for music playback.
Playlists are optimized for music, if you want to play sound effects functions in nitro::Audio should be of assistance to you. Apps can have one active playlist at a time which lives in nitro::App.playlist. To change the playlist stop App.playlist then assign a new playlist to App.playlist and then start App.playlist.
Fields
shuffle: bool
If this is true playlist will be shuffled on start and on loop
loop_music: bool
If this is true playlist will loop back to start when music is finished.
Methods
impl Playlist
[src]
fn new() -> Playlist
[src]
Creates a new playlist with no tracks, and shuffle and loop_music set to false.
fn start(&mut self)
[src]
Start playing this playlist.
Will not auto advance songs unless this playlist is attached to App::audio.playlist
fn stop(&mut self)
[src]
Stops music playback
fn next_track(&mut self)
[src]
Advance to the next track in the playlist
fn play_track(&mut self, track: usize) -> Result<(), String>
[src]
Returns err if track is not a valid index into self.tracks
fn current_track(&self) -> usize
[src]
fn add_track(&mut self, path: &str) -> Result<(), String>
[src]
Adds a new track to the playlist. The first track added will be track 0 the second track will be track 1, so on so forth.