From 51f6a56e678504b7951a02946313521f25bf0d25 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Thu, 20 Dec 2012 20:14:53 +0100 Subject: [PATCH] use AUDIODEVICE env variable --- sndioctl/sndioctl.1 | 15 ++------------- sndioctl/sndioctl.c | 7 ++++++- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/sndioctl/sndioctl.1 b/sndioctl/sndioctl.1 index e49dcfd..c3125b9 100644 --- a/sndioctl/sndioctl.1 +++ b/sndioctl/sndioctl.1 @@ -36,11 +36,11 @@ The options are as follows: .Bl -tag -width Ds .It Fl f Ar port Specifies the name of the -.It Fl v -Increase log verbosity. .Xr sndio 7 MIDI port to use, default is .Pa snd/0 +.It Fl v +Increase log verbosity. .El .Pp In no expression is given, @@ -53,23 +53,12 @@ If the expression is a stream name followed by .Qq = followed by a decimal in the 0..127 range, then the stream volume is set to the given value. -.Pp -If the stream name the percent character -.Pq Sq \&% , -any stream matches, -incuding empty server slots. .Sh EXAMPLES Set mplayer volume to 80: .Bd -literal -offset indent $ sndioctl mplayer0=80 .Ed -.Pp -Set all volumes to 80, including oncoming stream volumes: -.Bd -literal -offset indent -$ sndioctl %=80 -.Ed .Sh SEE ALSO .Xr sndiod 1 .Xr mio_open 3 -.Xr midi 4 .Xr sndio 7 diff --git a/sndioctl/sndioctl.c b/sndioctl/sndioctl.c index 11a8b41..8e49c6c 100644 --- a/sndioctl/sndioctl.c +++ b/sndioctl/sndioctl.c @@ -196,7 +196,7 @@ usage(void) int main(int argc, char **argv) { - char *dev = "snd/0"; + char *dev = NULL; unsigned char buf[MSGMAX], *lhs, *rhs; int c, cn, vol, size; @@ -215,6 +215,11 @@ main(int argc, char **argv) argc -= optind; argv += optind; + if (dev == NULL) + dev = getenv("AUDIODEVICE"); + if (dev == NULL) + dev = "snd/0"; + hdl = mio_open(dev, MIO_OUT | MIO_IN, 0); if (hdl == NULL) { fprintf(stderr, "%s: couldn't open MIDI device\n", dev);