From bebc22c4b060b47ddf482f7a1cb960c589687c7c Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 8 Sep 2013 00:37:29 +0000 Subject: [PATCH] fade: Implement new mode "set". 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 | 8 ++++++++ m4/gengetopt/fade.m4 | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/fade.c b/fade.c index 387e257a..8e9150f7 100644 --- 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; diff --git a/m4/gengetopt/fade.m4 b/m4/gengetopt/fade.m4 index 7c731c2b..ca99a398 100644 --- a/m4/gengetopt/fade.m4 +++ b/m4/gengetopt/fade.m4 @@ -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 + -- 2.39.2