changeset 2040:dbe615def81f trunk

[svn] Playlist shuffle behaviour should now be a little more consistant. When queue and manual jump are used, shuffle will remember where you were before jumping. It will use that location for the next/prev shuffle track, and not reshuffle each time.
author nazca
date Mon, 04 Dec 2006 00:57:49 -0800
parents 6ce84abe55ba
children ed1d3dde7130
files ChangeLog audacious/playlist.c
diffstat 2 files changed, 49 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 04 00:38:41 2006 -0800
+++ b/ChangeLog	Mon Dec 04 00:57:49 2006 -0800
@@ -1,3 +1,10 @@
+2006-12-04 08:38:41 +0000  Daniel Bradshaw <nazca@atheme.org>
+  revision [3081]
+  xentry.h is no more.
+  trunk/audacious/input.c |    1 -
+  1 file changed, 1 deletion(-)
+
+
 2006-12-04 08:22:32 +0000  William Pitcock <nenolod@nenolod.net>
   revision [3079]
   - remove xentry API
--- a/audacious/playlist.c	Mon Dec 04 00:38:41 2006 -0800
+++ b/audacious/playlist.c	Mon Dec 04 00:57:49 2006 -0800
@@ -61,6 +61,8 @@
 typedef void (*PlaylistSaveFunc) (FILE * file);
 
 PlaylistEntry *playlist_position;
+/* If we manually change the song, p_p_b_j will show us where to go back to */
+PlaylistEntry *playlist_position_before_jump = NULL;
 G_LOCK_DEFINE(playlist);
 
 static GList *playlist = NULL;
@@ -891,6 +893,12 @@
         PLAYLIST_UNLOCK();
         return;
     }
+    
+    if ((playlist_position_before_jump != NULL) && !queued_list)
+    {
+      playlist_position = playlist_position_before_jump;
+      playlist_position_before_jump = NULL;
+    }
 
     plist_pos_list = find_playlist_position_list();
 
@@ -944,6 +952,12 @@
         PLAYLIST_UNLOCK();
         return;
     }
+    
+		if ((playlist_position_before_jump != NULL) && !queued_list)
+    {
+      playlist_position = playlist_position_before_jump;
+      playlist_position_before_jump = NULL;
+    }
 
     plist_pos_list = find_playlist_position_list();
 
@@ -997,6 +1011,12 @@
     GList *it = list;
 
     PLAYLIST_LOCK();
+		
+    if ((cfg.shuffle) && (playlist_position_before_jump == NULL))
+    {
+      /* Shuffling and this is our first manual jump. */
+      playlist_position_before_jump = playlist_position;
+    }
 
     while (it) {
         GList *next = g_list_next(it);
@@ -1028,6 +1048,13 @@
     PlaylistEntry *entry;
 
     PLAYLIST_LOCK();
+    
+    if ((cfg.shuffle) && (playlist_position_before_jump == NULL))
+    {
+      /* Shuffling and this is our first manual jump. */
+      playlist_position_before_jump = playlist_position;
+    }
+
     entry = g_list_nth_data(playlist, pos);
     if ((tmp = g_list_find(queued_list, entry))) {
         queued_list = g_list_remove_link(queued_list, tmp);
@@ -1142,6 +1169,12 @@
         restart_playing = TRUE;
     }
 
+    if ((cfg.shuffle) && (playlist_position_before_jump == NULL))
+    {
+      /* Shuffling and this is our first manual jump. */
+      playlist_position_before_jump = playlist_position;
+    }
+		
     playlist_position = node->data;
     PLAYLIST_UNLOCK();
     playlist_check_pos_current();
@@ -1152,13 +1185,6 @@
         mainwin_set_info_text();
         playlistwin_update_list();
     }
-
-    /*
-     * Regenerate the shuffle list when the user set a position
-     * manually
-     */
-    playlist_generate_shuffle_list();
-    playlist_recalc_total_time();
 }
 
 void
@@ -1173,6 +1199,13 @@
       ip_data.stop = FALSE;
 
     PLAYLIST_LOCK();
+    
+    if ((playlist_position_before_jump != NULL) && !queued_list)
+    {
+      playlist_position = playlist_position_before_jump;
+      playlist_position_before_jump = NULL;
+    }
+		
     plist_pos_list = find_playlist_position_list();
 
     if (cfg.no_playlist_advance) {
@@ -2697,6 +2730,8 @@
 {
     PLAYLIST_LOCK();
 
+    playlist_position_before_jump = NULL;
+
     cfg.shuffle = shuffle;
     playlist_generate_shuffle_list_nolock();