]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
fade: Implement new mode "set".
authorAndre Noll <maan@systemlinux.org>
Sun, 8 Sep 2013 00:37:29 +0000 (00:37 +0000)
committerAndre Noll <maan@systemlinux.org>
Sun, 22 Dec 2013 21:25:06 +0000 (21:25 +0000)
While setting the value of a mixer channel has always been possible
using --fade with a zero timeout, this method is somewhat tedious. This
patch introduces the new "set" mode for this purpose.

fade.c
m4/gengetopt/fade.m4

diff --git a/fade.c b/fade.c
index 387e257a6aa5026c4a1c234c4e2ad9983f387ff4..8e9150f7d480df6f2032f334bb7575d48cc231f0 100644 (file)
--- a/fade.c
+++ b/fade.c
@@ -264,6 +264,11 @@ static int set_channel(struct mixer *m, struct mixer_handle *h)
        return ret;
 }
 
+static int set_val(struct mixer *m, struct mixer_handle *h)
+{
+       return m->set(h, conf.val_arg);
+}
+
 static struct mixer *get_mixer_or_die(void)
 {
        int i;
@@ -340,6 +345,9 @@ int main(int argc, char *argv[])
        case mode_arg_snooze:
                ret = snooze(m, h);
                break;
+       case mode_arg_set:
+               ret = set_val(m, h);
+               break;
        default: /* sleep mode */
                ret = sweet_dreams(m, h);
                break;
index 7c731c2b6ec1cdf15322131827fe99add0917e09..ca99a398e812d5857107794ad0fa5e89b5195977 100644 (file)
@@ -17,11 +17,11 @@ option "mode" o
 #~~~~~~~~~~~~~~
 "how to fade volume"
        enum typestr = "mode"
-       values = "sleep", "snooze", "fade"
+       values = "sleep", "fade", "set", "snooze"
        default = "sleep"
        optional
        details="
-               para_fade knows three different fading modes:
+               para_fade knows the following modes:
 
                sleep mode: Change to the initial volume and select
                the initial afs mood/playlist. Then fade out until
@@ -33,6 +33,8 @@ option "mode" o
                fade: Fade the volume to the given value in the
                given time.
 
+               set: Just set the value and exit.
+
                snooze: Fade out, sleep a bit and fade in.
 "
 
@@ -228,4 +230,14 @@ option "fade-time" t
        int typestr = "seconds"
        default = "5"
        optional
+
+section "Options for set mode"
+##############################
+
+option "val" -
+"value to set"
+       int typestr = "value"
+       default = "0"
+       optional
+
 </qu>