]> git.tue.mpg.de Git - paraslash.git/commitdiff
mixer: sleep: Always set initial volume and channel.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 5 Mar 2022 20:03:15 +0000 (21:03 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 16 Oct 2022 16:53:02 +0000 (18:53 +0200)
It does not hurt to do this unconditionally, and it simplifies
subsequent work.

mixer.c

diff --git a/mixer.c b/mixer.c
index eae8929164770053c5c18843f4cf4e4e8bc5e616..42651d6a9a7ae10c9703b1c3e32516cb4accba9f 100644 (file)
--- a/mixer.c
+++ b/mixer.c
@@ -318,15 +318,19 @@ static int com_sleep(const struct mixer *m)
        PARA_INFO_LOG("waketime: %d:%02d\n", tm->tm_hour, tm->tm_min);
        client_cmd("stop");
        sleep(1);
+       ret = set_initial_volume(m, h);
+       if (ret < 0)
+               goto close_mixer;
+       /*
+        * Setting the volume invalidates the current channel setting, so we
+        * have to set it again.
+        */
+       ret = set_channel(m, h, OPT_STRING_VAL(PARA_MIXER, MIXER_CHANNEL));
+       if (ret < 0)
+               goto close_mixer;
        if (fot && fo_mood && *fo_mood) {
-               ret = set_initial_volume(m, h);
-               if (ret < 0)
-                       goto close_mixer;
                change_afs_mode(fo_mood);
                client_cmd("play");
-               ret = set_channel(m, h, OPT_STRING_VAL(PARA_MIXER, MIXER_CHANNEL));
-               if (ret < 0)
-                       goto close_mixer;
                ret = fade(m, h, fov, fot);
                if (ret < 0)
                        goto close_mixer;