mixer: sleep: Change to next file at fade-in time.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 11 Aug 2018 14:01:51 +0000 (16:01 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 13 Aug 2018 17:58:03 +0000 (19:58 +0200)
If a sleep mood is given, we currently start fading in with the current
file of the sleep mood still playing.  It might therefore take a long
time until the first file of the fade-in mood is started. This patch
avoids this problem by running "para client next" at fade-in time
right after the mood has been changed to the fade-in mood.

mixer.c

diff --git a/mixer.c b/mixer.c
index f0d5a02..4ceaba9 100644 (file)
--- a/mixer.c
+++ b/mixer.c
@@ -324,7 +324,10 @@ static int com_sleep(const struct mixer *m, struct mixer_handle *h)
                sleep(delay);
        }
        change_afs_mode(fi_mood);
-       client_cmd("play");
+       if (sleep_mood) /* currently playing */
+               client_cmd("next");
+       else /* currently stopped */
+               client_cmd("play");
        ret = fade(m, h, fiv, fit);
        PARA_INFO_LOG("fade complete, returning\n");
        return ret;