diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-11-07 21:01:16 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2008-11-07 21:01:16 +0000 |
commit | aec8d3abf216663cfafeba0fa3e1c84f7de452d3 (patch) | |
tree | f111daa0df7800e53fa065638c200e0334aa81bf /usr.bin/aucat/aucat.c | |
parent | 2644f1005720abae0bcf36faedaac6eb8ccfe601 (diff) |
expose the block size in the sndio API by making par->round writable
and thus remove the ugly rate <-> block-size table from
sio_setpar(3). Handle the block size negociation in aucat(1), since
it has few constrains the code is overally simpler.
ok jakemsr@, major crank suggested by deraadt@
Diffstat (limited to 'usr.bin/aucat/aucat.c')
-rw-r--r-- | usr.bin/aucat/aucat.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c index 5e41f46c65a..b41b43770cf 100644 --- a/usr.bin/aucat/aucat.c +++ b/usr.bin/aucat/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.31 2008/11/03 22:25:13 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.32 2008/11/07 21:01:15 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -288,7 +288,7 @@ main(int argc, char **argv) struct farglist ifiles, ofiles; struct aparams ipar, opar, dipar, dopar; struct sigaction sa; - unsigned ivol, ovol, bufsz = 0; + unsigned ivol, ovol, bufsz; char *devpath, *dbgenv, *listenpath; const char *errstr; extern char *malloc_options; @@ -304,7 +304,6 @@ main(int argc, char **argv) aparams_init(&ipar, 0, 1, 44100); aparams_init(&opar, 0, 1, 44100); - u_flag = 0; l_flag = 0; devpath = NULL; @@ -313,6 +312,7 @@ main(int argc, char **argv) hdr = HDR_AUTO; xrun = XRUN_IGNORE; 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) { @@ -357,7 +357,7 @@ main(int argc, char **argv) u_flag = 1; break; case 'b': - if (sscanf(optarg, "%u", &bufsz) != 1) { + if (sscanf(optarg, "%u", &bufsz) != 1 || bufsz == 0) { fprintf(stderr, "%s: bad buf size\n", optarg); exit(1); } @@ -438,12 +438,13 @@ main(int argc, char **argv) filelist_init(); /* - * Open the device. + * Open the device. Give half of the buffer to the device, + * the other half is for the socket/files */ dev_init(devpath, (l_flag || !SLIST_EMPTY(&ofiles)) ? &dipar : NULL, (l_flag || !SLIST_EMPTY(&ifiles)) ? &dopar : NULL, - bufsz); + bufsz, l_flag); if (l_flag) { listenpath = getenv("AUCAT_SOCKET"); |