ref: 61cfb51244f83d2961bd359c2916c09ce022b942
parent: 504011b50809153ffd3d22d9da036e42f2fcdc37
author: Sigrid Haflínudóttir <[email protected]>
date: Mon Dec 9 10:14:27 EST 2019
fast seek, keys "," and "."
--- a/README.md
+++ b/README.md
@@ -39,7 +39,8 @@
## Hot keys
```
-left/right - seek backwards/forward
+left/right - seek backwards/forward (10 seconds step)
+,/. - seek backwards/forward (one minute step)
up/down/pgup/pgdn/home/end - move within the playlist
o - move to the currently playing track
enter - play the selected track
--- a/zuke.c
+++ b/zuke.c
@@ -16,6 +16,8 @@
Ctoggle,
Cforward,
Cbackward,
+ Cforwardfast,
+ Cbackwardfast,
Everror = 1,
Evready,
@@ -22,6 +24,7 @@
Bps = 44100*2*2, /* 44100KHz, stereo, u16 for a sample */
Seekbytes = Bps*10, /* 10 seconds */
+ Seekbytesfast = Bps*60, /* 1 minute */
Scrollwidth = 12,
Scrollheight = 16,
@@ -97,7 +100,7 @@
total = mincolwidth[0] + mincolwidth[1] + mincolwidth[2];
for(i = 0; i < nelem(mincolwidth); i++)
- colwidth[i] = (Dx(screen->r) - 8) * mincolwidth[i] / total;
+ colwidth[i] = (Dx(screen->r) - 8) * mincolwidth[i] / total;
}
static void
@@ -460,10 +463,16 @@
goto stop;
}else if(c == Cforward){
bytesfrom = byteswritten + Seekbytes;
+ }else if(c == Cforwardfast){
+ bytesfrom = byteswritten + Seekbytesfast;
}else if(c == Cbackward){ /* to seek backwards we need to restart playback */
bytesfrom = byteswritten >= Seekbytes ? byteswritten - Seekbytes : 0;
n = 0; /* not an error */
break;
+ }else if(c == Cbackwardfast){
+ bytesfrom = byteswritten >= Seekbytesfast ? byteswritten - Seekbytesfast : 0;
+ n = 0; /* not an error */
+ break;
}
c = 0;
@@ -537,6 +546,20 @@
}
static void
+backwardfast(Player *player)
+{
+ if(player != nil)
+ sendul(player->ctl, Cbackwardfast);
+}
+
+static void
+forwardfast(Player *player)
+{
+ if(player != nil)
+ sendul(player->ctl, Cforwardfast);
+}
+
+static void
readplist(void)
{
Meta *m;
@@ -773,6 +796,12 @@
break;
case Kright:
forward(playercurr);
+ break;
+ case ',':
+ backwardfast(playercurr);
+ break;
+ case '.':
+ forwardfast(playercurr);
break;
case Kup:
pcur--;