summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/aucat/aucat.c4
-rw-r--r--usr.bin/aucat/dev.c43
-rw-r--r--usr.bin/aucat/dev.h6
-rw-r--r--usr.bin/aucat/sock.c33
4 files changed, 18 insertions, 68 deletions
diff --git a/usr.bin/aucat/aucat.c b/usr.bin/aucat/aucat.c
index daa3d727d2c..e619167a9be 100644
--- a/usr.bin/aucat/aucat.c
+++ b/usr.bin/aucat/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.93 2010/06/05 12:45:48 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.94 2010/06/05 16:00:52 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -723,7 +723,7 @@ aucat_main(int argc, char **argv)
} else {
d = dev_new_sio(cd->path, cd->mode,
&cd->ipar, &cd->opar, cd->bufsz, cd->round,
- cd->hold, l_flag);
+ cd->hold);
}
if (d == NULL)
errx(1, "%s: can't open device", cd->path);
diff --git a/usr.bin/aucat/dev.c b/usr.bin/aucat/dev.c
index 19b73b08f70..3a259c42e9c 100644
--- a/usr.bin/aucat/dev.c
+++ b/usr.bin/aucat/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.57 2010/06/04 06:15:28 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.58 2010/06/05 16:00:52 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -105,7 +105,6 @@ void dev_close(struct dev *);
void dev_start(struct dev *);
void dev_stop(struct dev *);
void dev_clear(struct dev *);
-void dev_prime(struct dev *);
struct dev *dev_list = NULL;
@@ -115,7 +114,7 @@ struct dev *dev_list = NULL;
struct dev *
dev_new_sio(char *path,
unsigned mode, struct aparams *dipar, struct aparams *dopar,
- unsigned bufsz, unsigned round, unsigned hold, unsigned prime)
+ unsigned bufsz, unsigned round, unsigned hold)
{
struct dev *d;
@@ -132,7 +131,6 @@ dev_new_sio(char *path,
d->reqipar = *dipar;
d->reqbufsz = bufsz;
d->reqround = round;
- d->prime = prime;
d->hold = hold;
d->pstate = DEV_CLOSED;
d->next = dev_list;
@@ -171,7 +169,6 @@ dev_new_loop(struct aparams *dipar, struct aparams *dopar, unsigned bufsz)
d->reqmode = MODE_PLAY | MODE_REC | MODE_LOOP;
d->pstate = DEV_CLOSED;
d->hold = 0;
- d->prime = 0;
d->next = dev_list;
dev_list = d;
return d;
@@ -193,7 +190,6 @@ dev_new_thru(void)
d->reqmode = 0;
d->pstate = DEV_CLOSED;
d->hold = 0;
- d->prime = 0;
d->next = dev_list;
dev_list = d;
return d;
@@ -391,8 +387,6 @@ dev_open(struct dev *d)
}
#endif
d->pstate = DEV_INIT;
- if (d->prime)
- dev_prime(d);
return 1;
}
@@ -748,11 +742,8 @@ dev_run(struct dev *d)
dev_stop(d);
if (d->refcnt == 0 && !d->hold)
dev_close(d);
- else {
+ else
dev_clear(d);
- if (d->prime)
- dev_prime(d);
- }
}
break;
}
@@ -760,10 +751,7 @@ dev_run(struct dev *d)
}
/*
- * If the device is paused, then resume it. If the caller is using
- * full-duplex and its buffers are small, the ``prime'' flag
- * could be set to initialize device buffers with silence
- *
+ * If the device is paused, then resume it.
* This routine can be called from aproc context.
*/
void
@@ -1151,26 +1139,3 @@ dev_clear(struct dev *d)
mon_clear(d->mon);
}
}
-
-/*
- * Fill with silence play buffers and schedule the same amount of recorded
- * samples to drop
- */
-void
-dev_prime(struct dev *d)
-{
-
-#ifdef DEBUG
- if (debug_level >= 3)
- dbg_puts("priming device\n");
-#endif
- if (APROC_OK(d->mix)) {
-#ifdef DEBUG
- if (!LIST_EMPTY(&d->mix->ins)) {
- dbg_puts("play end not idle, can't prime device\n");
- dbg_panic();
- }
-#endif
- mix_prime(d->mix);
- }
-}
diff --git a/usr.bin/aucat/dev.h b/usr.bin/aucat/dev.h
index 62ad96b074e..ab8f412fd23 100644
--- a/usr.bin/aucat/dev.h
+++ b/usr.bin/aucat/dev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.h,v 1.24 2010/06/04 06:15:28 ratchov Exp $ */
+/* $OpenBSD: dev.h,v 1.25 2010/06/05 16:00:52 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -32,7 +32,6 @@ struct dev {
unsigned reqbufsz; /* buffer size */
unsigned reqround; /* block size */
unsigned reqrate; /* sample rate */
- unsigned prime; /* prime play buffer? */
unsigned hold; /* hold the device open ? */
unsigned refcnt; /* number of openers */
#define DEV_CLOSED 0 /* closed */
@@ -63,8 +62,7 @@ void dev_wakeup(struct dev *);
struct dev *dev_new_thru(void);
struct dev *dev_new_loop(struct aparams *, struct aparams *, unsigned);
struct dev *dev_new_sio(char *, unsigned,
- struct aparams *, struct aparams *, unsigned, unsigned,
- unsigned, unsigned);
+ struct aparams *, struct aparams *, unsigned, unsigned, unsigned);
int dev_thruadd(struct dev *, char *, int, int);
void dev_midiattach(struct dev *, struct abuf *, struct abuf *);
unsigned dev_roundof(struct dev *, unsigned);
diff --git a/usr.bin/aucat/sock.c b/usr.bin/aucat/sock.c
index 624b1ecd5ea..4eec95f70e6 100644
--- a/usr.bin/aucat/sock.c
+++ b/usr.bin/aucat/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.49 2010/06/05 12:45:48 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.50 2010/06/05 16:00:52 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -409,23 +409,25 @@ void
sock_allocbuf(struct sock *f)
{
struct abuf *rbuf = NULL, *wbuf = NULL;
+ unsigned bufsz;
+ bufsz = f->bufsz + f->dev->bufsz / f->dev->round * f->round;
f->pstate = SOCK_START;
if (f->mode & AMSG_PLAY) {
- rbuf = abuf_new(f->bufsz, &f->rpar);
+ rbuf = abuf_new(bufsz, &f->rpar);
aproc_setout(f->pipe.file.rproc, rbuf);
if (!ABUF_WOK(rbuf) || (f->pipe.file.state & FILE_EOF))
f->pstate = SOCK_READY;
+ f->rmax = bufsz * aparams_bpf(&f->rpar);
}
if (f->mode & AMSG_RECMASK) {
- wbuf = abuf_new(f->bufsz, &f->wpar);
+ wbuf = abuf_new(bufsz, &f->wpar);
aproc_setin(f->pipe.file.wproc, wbuf);
f->walign = f->round;
+ f->wmax = 0;
}
f->delta = 0;
f->startpos = 0;
- f->wmax = 0;
- f->rmax = f->bufsz;
f->tickpending = 0;
f->startpending = 0;
#ifdef DEBUG
@@ -433,6 +435,8 @@ sock_allocbuf(struct sock *f)
sock_dbg(f);
dbg_puts(": allocating ");
dbg_putu(f->bufsz);
+ dbg_puts("/");
+ dbg_putu(bufsz);
dbg_puts(" fr buffers, rmax = ");
dbg_putu(f->rmax);
dbg_puts("\n");
@@ -926,24 +930,6 @@ sock_setpar(struct sock *f)
}
#endif
}
- if (AMSG_ISSET(p->bufsz)) {
- /*
- * XXX: bufsz will become read-only, but for now
- * allow old library to properly work
- */
-#ifdef DEBUG
- if (debug_level >= 1) {
- sock_dbg(f);
- dbg_puts(": legacy client using ");
- dbg_putx(p->bufsz);
- dbg_puts("fr total buffer size\n");
- }
-#endif
- min = (f->dev->bufsz / f->dev->round) * f->round;
- if (p->bufsz < min)
- p->bufsz = min;
- p->appbufsz = p->bufsz - min;
- }
if (AMSG_ISSET(p->appbufsz)) {
rate = (f->mode & AMSG_PLAY) ? f->rpar.rate : f->wpar.rate;
min = 1;
@@ -1508,6 +1494,7 @@ sock_buildmsg(struct sock *f)
AMSG_INIT(&f->wmsg);
f->wmsg.cmd = AMSG_POS;
f->wmsg.u.ts.delta = f->startpos;
+ f->rmax += f->startpos;
f->wtodo = sizeof(struct amsg);
f->wstate = SOCK_WMSG;
f->startpending = 0;