shithub: riscv

Download patch

ref: f466d4a75b8027f195c79e67d898c0da23811f47
parent: 5bd3330e0bad0b0f02d05139822f7412c232880c
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Sep 21 15:04:18 EDT 2022

audio/zuke: fix playlist plumbing while in shuffled mode

--- a/sys/src/cmd/audio/zuke/zuke.c
+++ b/sys/src/cmd/audio/zuke/zuke.c
@@ -1099,7 +1099,7 @@
 static void
 plumbaudio(void *kbd)
 {
-	int i, f, pf, mcw[Ncol], wasplaying;
+	int i, f, pf, mcw[Ncol], playing, shuffled;
 	Playlist *p;
 	Plumbmsg *m;
 	char *s, *e;
@@ -1123,7 +1123,9 @@
 				close(pf);
 				if(p == nil)
 					continue;
-				wasplaying = pcurplaying;
+				playing = pcurplaying;
+				if(shuffled = (shuffle != nil))
+					sendul(kbd, 's');
 				/* make sure nothing is playing */
 				while(pcurplaying >= 0){
 					sendul(kbd, 'v');
@@ -1134,7 +1136,12 @@
 				memmove(mincolwidth, mcw, sizeof(mincolwidth));
 				adjustcolumns();
 				pcur = 0;
-				if(wasplaying >= 0)
+				if(shuffled){
+					pcur = nrand(pl->n);
+					sendul(kbd, 's');
+				}
+				redraw(1);
+				if(playing >= 0)
 					sendul(kbd, '\n');
 			}else{
 				for(i = 0; i < pl->n; i++){