diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-11-08 10:40:53 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-11-08 10:40:53 +0000 |
commit | a3087f8426a5d780d7d45b8fba030e024e9cfc23 (patch) | |
tree | d5ea25a11063ec341c41dab0f8bf75d7933f636c | |
parent | db4b8b2a0f9c2ddb369ec47cb36774c8e0490e68 (diff) |
set the default device to /dev/audio for legacy mode.
From Thomas Pfaff <tpfaff _at_ agderlink.no> and tweaks from me
-rw-r--r-- | usr.bin/aucat/aucat.c | 5 | ||||
-rw-r--r-- | usr.bin/aucat/legacy.c | 9 | ||||
-rw-r--r-- | usr.bin/aucat/safile.c | 10 |
3 files changed, 15 insertions, 9 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c index b41b43770cf..ad435887235 100644 --- a/usr.bin/aucat/aucat.c +++ b/usr.bin/aucat/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.32 2008/11/07 21:01:15 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.33 2008/11/08 10:40:52 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -314,8 +314,7 @@ main(int argc, char **argv) ivol = ovol = MIDI_TO_ADATA(127); bufsz = 44100 * 4 / 15; /* XXX: use milliseconds, not frames */ - while ((c = getopt(argc, argv, "b:c:C:e:r:h:x:i:o:f:lu")) - != -1) { + while ((c = getopt(argc, argv, "b:c:C:e:r:h:x:i:o:f:lu")) != -1) { switch (c) { case 'h': hdr = opt_hdr(); diff --git a/usr.bin/aucat/legacy.c b/usr.bin/aucat/legacy.c index 70df6ec4750..319dd87e9a5 100644 --- a/usr.bin/aucat/legacy.c +++ b/usr.bin/aucat/legacy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: legacy.c,v 1.3 2008/10/26 08:49:44 ratchov Exp $ */ +/* $OpenBSD: legacy.c,v 1.4 2008/11/08 10:40:52 ratchov Exp $ */ /* * Copyright (c) 1997 Kenneth Stailey. All rights reserved. * @@ -32,6 +32,7 @@ #include <sys/ioctl.h> #include <sys/audioio.h> +#include <stdlib.h> #include <fcntl.h> #include <string.h> #include <unistd.h> @@ -161,7 +162,11 @@ legacy_play(char *dev, char *aufile) if (fmt == FMT_RAW || fmt == FMT_AU) if (lseek(fd, (off_t)pos, SEEK_SET) == -1) warn("lseek"); - + if (dev == NULL) { + dev = getenv("AUDIODEVICE"); + if (dev == NULL) + dev = "/dev/audio"; + } if ((afd = open(dev, O_WRONLY)) < 0) { warn("can't open %s", dev); return(1); diff --git a/usr.bin/aucat/safile.c b/usr.bin/aucat/safile.c index 5d60f99ab02..0f4d2673e2a 100644 --- a/usr.bin/aucat/safile.c +++ b/usr.bin/aucat/safile.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safile.c,v 1.3 2008/11/07 21:01:15 ratchov Exp $ */ +/* $OpenBSD: safile.c,v 1.4 2008/11/08 10:40:52 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -106,7 +106,7 @@ safile_trypar(struct sio_hdl *hdl, struct sio_par *par, int blkio) unsigned round = par->round; if (!blkio) { - fprintf(stderr, "not setting block size\n"); + DPRINTF("safile_trypar: not setting block size\n"); if (!sio_setpar(hdl, par)) return 0; if (!sio_getpar(hdl, par)) @@ -192,8 +192,10 @@ safile_new(struct fileops *ops, char *path, mode |= SIO_REC; if (opar) mode |= SIO_PLAY; - if (!mode) - fprintf(stderr, "%s: must at least play or record", path); + if (!mode) { + fprintf(stderr, "select at least play or record mode\n"); + return NULL; + } hdl = sio_open(path, mode, 1); if (hdl == NULL) { fprintf(stderr, "safile_new: can't open device\n"); |