changeset 13708:c29255ab4712

fix -loop in combination with -shuffle
author reimar
date Wed, 20 Oct 2004 17:30:29 +0000
parents 3fff37ed4fe7
children 3bf608c6e34c
files playtree.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/playtree.c	Wed Oct 20 16:38:33 2004 +0000
+++ b/playtree.c	Wed Oct 20 17:30:29 2004 +0000
@@ -585,6 +585,14 @@
   
   if(pt == NULL) { // No next
     // Must we loop?
+    if (iter->mode == PLAY_TREE_ITER_RND) {
+      if (iter->root->loop == 0)
+        return PLAY_TREE_ITER_END;
+      play_tree_unset_flag(iter->root, PLAY_TREE_RND_PLAYED, -1);
+      if (iter->root->loop > 0) iter->root->loop--;
+      // try again
+      return play_tree_iter_step(iter, 0, with_nodes);
+    } else
     if(iter->tree->parent && iter->tree->parent->loop != 0 && ((d > 0 && iter->loop != 0) || ( d < 0 && (iter->loop < 0 || iter->loop < iter->tree->parent->loop) ) ) ) { 
       if(d > 0) { // Go back to the first one
 	for(pt = iter->tree ; pt->prev != NULL; pt = pt->prev)