diff options
author | jkh <jkh@FreeBSD.org> | 2000-05-20 23:25:08 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2000-05-20 23:25:08 +0000 |
commit | cf6c24f27fe8bcec29b7313b320687b9ecdb74ed (patch) | |
tree | b36cd5a26ae5e24e5653e4ee51a9c6d72eea741c /usr.sbin/mixer | |
parent | 1db238984d198d018ab2fb5b8378275ade79695b (diff) | |
download | FreeBSD-src-cf6c24f27fe8bcec29b7313b320687b9ecdb74ed.zip FreeBSD-src-cf6c24f27fe8bcec29b7313b320687b9ecdb74ed.tar.gz |
I've always wanted to be able to dump out the current values of
the mixer in a format suitable for saving and handing off to
mixer(1) at some future date to restore the settings.
Add a -s flag to do this.
Diffstat (limited to 'usr.sbin/mixer')
-rw-r--r-- | usr.sbin/mixer/mixer.8 | 8 | ||||
-rw-r--r-- | usr.sbin/mixer/mixer.c | 20 |
2 files changed, 23 insertions, 5 deletions
diff --git a/usr.sbin/mixer/mixer.8 b/usr.sbin/mixer/mixer.8 index 55d2898..d429528 100644 --- a/usr.sbin/mixer/mixer.8 +++ b/usr.sbin/mixer/mixer.8 @@ -36,6 +36,7 @@ .Sh SYNOPSIS .Nm .Op Fl f Ar device +.Op Fl s .Oo .Oo Ns .Ar dev Op Ar lvol Ns Op Ar :rvol @@ -79,6 +80,13 @@ and .Ar rvol arguments may be from 0 - 100. .Pp +If the +.Fl s +flag is used, the current mixer values will be displayed in a format suitable +for use as the command-line arguments to a future invocation of +.Nm +(as above). +.Pp To change the recording device you use one of: .Bl -tag -width =rec -offset indent .It ^rec diff --git a/usr.sbin/mixer/mixer.c b/usr.sbin/mixer/mixer.c index feb3193..21b3580 100644 --- a/usr.sbin/mixer/mixer.c +++ b/usr.sbin/mixer/mixer.c @@ -35,7 +35,7 @@ usage(int devmask, int recmask) { int i, n; - printf("usage: mixer [[dev [voll[:volr]] | recsrc | {^|+|-|=}rec recdev] ... ]\n"); + printf("usage: mixer [-s] [[dev [voll[:volr]] | recsrc | {^|+|-|=}rec recdev] ... ]\n"); printf(" devices: "); for (i = 0, n = 0; i < SOUND_MIXER_NRDEVICES; i++) if ((1 << i) & devmask) { @@ -89,7 +89,7 @@ main(int argc, char *argv[]) { int foo, bar, baz, dev; int devmask = 0, recmask = 0, recsrc = 0, orecsrc; - int dusage = 0, drecsrc = 0; + int dusage = 0, drecsrc = 0, shortflag = 0; int l, r; char *name; @@ -101,6 +101,10 @@ main(int argc, char *argv[]) else if (!strcmp(argv[0], "mixer3")) name = strdup("/dev/mixer2"); + if (argc > 1 && strcmp(argv[1], "-s") == 0) { + shortflag = 1; + argc -= 1; argv += 1; + } if (argc > 2 && strcmp(argv[1], "-f") == 0) { name = strdup(argv[2]); argc -= 2; argv += 2; @@ -125,7 +129,10 @@ main(int argc, char *argv[]) warn("MIXER_READ"); continue; } - printf("Mixer %-8s is currently set to %3d:%d\n", names[foo], bar & 0x7f, (bar >> 8) & 0x7f); + if (shortflag) + printf("%s %d:%d ", names[foo], bar & 0x7f, (bar >> 8) & 0x7f); + else + printf("Mixer %-8s is currently set to %3d:%d\n", names[foo], bar & 0x7f, (bar >> 8) & 0x7f); } return(0); } @@ -181,8 +188,11 @@ main(int argc, char *argv[]) argc--; argv++; continue; } - printf("Mixer %-8s is currently set to %3d:%d\n", - names[dev], bar & 0x7f, (bar >> 8) & 0x7f); + if (shortflag) + printf("%s %d:%d ", names[dev], bar & 0x7f, (bar >> 8) & 0x7f); + else + printf("Mixer %-8s is currently set to %3d:%d\n", + names[dev], bar & 0x7f, (bar >> 8) & 0x7f); argc--; argv++; break; |