]> git.tdb.fi Git - libs/al.git/blobdiff - source/jukebox.cpp
Add a previous() method to Jukebox
[libs/al.git] / source / jukebox.cpp
index 391edd14a305a6485f9a0741cd672bde0fef3c2e..b8224b29596acd234f67c5cb22c7104cbb6eb83d 100644 (file)
@@ -111,6 +111,22 @@ void Jukebox::next()
        play();
 }
 
+void Jukebox::previous()
+{
+       if(shuffle)
+               return next();
+
+       stop();
+       if(tracks.size()>1)
+       {
+               if(current_track==tracks.begin())
+                       current_track=tracks.end();
+               --current_track;
+               signal_track_changed.emit(*current_track);
+       }
+       play();
+}
+
 void Jukebox::stop()
 {
        streamer.stop();