use AUDIODEVICE env variable

This commit is contained in:
Alexandre Ratchov 2012-12-20 20:14:53 +01:00
parent 470c3b98b0
commit 51f6a56e67
2 changed files with 8 additions and 14 deletions

View File

@ -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

View File

@ -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);