commit 588471687b811345cf05be4689386b3bff7f6452
parent fbba73ebb4d999eac0e68f8c06d8cd022f15dc01
Author: sin <sin@2f30.org>
Date: Thu, 25 Dec 2014 14:43:34 +0000
If a song is already playing, properly close the decoder before moving on
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cmd.c b/cmd.c
@@ -66,7 +66,7 @@ cmdpause(int fd, int argc, char **argv)
void
cmdplay(int fd, int argc, char **argv)
{
- Song *s;
+ Song *s, *cur;
int id, i;
if (argc != 2) {
@@ -81,6 +81,12 @@ cmdplay(int fd, int argc, char **argv)
return;
}
+ cur = getcursong();
+ if (cur) {
+ decoder->close();
+ cur->state = NONE;
+ }
+
s->state = PREPARE;
putcursong(s);