summaryrefslogtreecommitdiff
path: root/usr.bin/aucat/opt.c
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-04-06 20:07:02 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2010-04-06 20:07:02 +0000
commit2f0029d887ad28970097e28bce6373cc22d35c2d (patch)
tree895e5e0cfc9d6210ff01a77b70088a93fb1c410b /usr.bin/aucat/opt.c
parent82289922c532d67b5593b04881bc3e2fd0002e3f (diff)
aucat (server):
- make the ``-m mode'' option per subdevice, allowing subdevices to be play-only or rec-only even if the server is full-duplex - add ``monitoring'' mode (with ``-m mon''). This is a record-only stream from which played streams can be recorded (kind of ``record what you hear''). - allow MIDI devices to be subscribed to the controlling MIDI port of the server, ie what midicat does (with -f option), but using the -q option. - add flow control to the protocol, and serialize clock ticks (sio_onmove() calls) and data chunks. This should fix certain full-duplex programs, broken with ``magic'' block/buffer size combinations. - enable 3 block latency which is the minimum theoretical. Make -z and -b options correspond to device parameters. - make sio_getcap(3) the same for aucat and sun backends, ie return whatever is supported (``everything'' in the aucat case, since everything is actulally supported). aucat (player): - enable ``-m mode'' option to select between monitoring and recording when ``-o file'' is used. - plug MIDI code to non-server codepath. The MIDI control device is specified with the ``-q device'' option, as in server mode. - impliment lseek()'ing within files (controlled through MIDI). Necessary to use aucat with a MIDI sequencer. midicat (thrubox): - rename ``-f'' flag to ``-q'', so it has the same name as in aucat (-f is still working) ok jakemsr@, tweaks from jmc@
Diffstat (limited to 'usr.bin/aucat/opt.c')
-rw-r--r--usr.bin/aucat/opt.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/usr.bin/aucat/opt.c b/usr.bin/aucat/opt.c
index 2bcaee5a3fc..a8975338ee8 100644
--- a/usr.bin/aucat/opt.c
+++ b/usr.bin/aucat/opt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: opt.c,v 1.6 2010/04/03 17:59:17 ratchov Exp $ */
+/* $OpenBSD: opt.c,v 1.7 2010/04/06 20:07:01 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -27,8 +27,8 @@
struct optlist opt_list = SLIST_HEAD_INITIALIZER(&opt_list);
void
-opt_new(char *name,
- struct aparams *wpar, struct aparams *rpar, int maxweight, int mmc)
+opt_new(char *name, struct aparams *wpar, struct aparams *rpar,
+ int maxweight, int mmc, unsigned mode)
{
struct opt *o;
unsigned len;
@@ -54,21 +54,39 @@ opt_new(char *name,
exit(1);
}
memcpy(o->name, name, len + 1);
- o->wpar = *wpar;
- o->rpar = *rpar;
+ if (mode & MODE_RECMASK)
+ o->wpar = (mode & MODE_MON) ? *rpar : *wpar;
+ if (mode & MODE_PLAY)
+ o->rpar = *rpar;
o->maxweight = maxweight;
o->mmc = mmc;
+ o->mode = mode;
#ifdef DEBUG
if (debug_level >= 2) {
dbg_puts(o->name);
- dbg_puts(": rec ");
- aparams_dbg(&o->wpar);
- dbg_puts(", play ");
- aparams_dbg(&o->rpar);
- dbg_puts(", vol ");
- dbg_putu(o->maxweight);
+ dbg_puts(":");
+ if (mode & MODE_REC) {
+ dbg_puts(" rec=");
+ dbg_putu(o->wpar.cmin);
+ dbg_puts(":");
+ dbg_putu(o->wpar.cmax);
+ }
+ if (mode & MODE_PLAY) {
+ dbg_puts(" play=");
+ dbg_putu(o->rpar.cmin);
+ dbg_puts(":");
+ dbg_putu(o->rpar.cmax);
+ dbg_puts(" vol=");
+ dbg_putu(o->maxweight);
+ }
+ if (mode & MODE_MON) {
+ dbg_puts(" mon=");
+ dbg_putu(o->wpar.cmin);
+ dbg_puts(":");
+ dbg_putu(o->wpar.cmax);
+ }
if (o->mmc)
- dbg_puts(", mmc");
+ dbg_puts(" mmc");
dbg_puts("\n");
}
#endif