version 1.13, 2009/02/04 20:35:14 |
version 1.14, 2009/02/06 08:29:35 |
|
|
{ |
{ |
struct sock *f = (struct sock *)p->u.io.file; |
struct sock *f = (struct sock *)p->u.io.file; |
|
|
f->odelta += delta; |
if (!(f->mode & AMSG_PLAY)) |
DPRINTFN(3, "rsock_opos: %p: delta = %d, odelta = %d\n", |
return; |
f, delta, f->odelta); |
|
|
|
|
f->delta += delta; |
|
DPRINTFN(3, "rsock_opos: %p: delta = %d, f->delta = %d\n", |
|
f, delta, f->delta); |
|
|
/* |
/* |
* negative deltas are xrun notifications for internal uses |
* negative deltas are xrun notifications for internal uses |
* only. Dont generate a packet for this, the client will be |
* only. Dont generate a packet for this, the client will be |
* notified later. |
* notified later. |
*/ |
*/ |
if (delta <= 0) |
if (delta < 0) |
return; |
return; |
|
f->tickpending++; |
for (;;) { |
for (;;) { |
if (!sock_write(f)) |
if (!sock_write(f)) |
break; |
break; |
|
|
{ |
{ |
struct sock *f = (struct sock *)p->u.io.file; |
struct sock *f = (struct sock *)p->u.io.file; |
|
|
f->idelta += delta; |
if (!(f->mode & AMSG_REC)) |
DPRINTFN(3, "wsock_ipos: %p, delta = %d, odelta = %d\n", |
return; |
f, delta, f->idelta); |
|
|
|
|
f->delta += delta; |
|
DPRINTFN(3, "wsock_ipos: %p, delta = %d, f->delta = %d\n", |
|
f, delta, f->delta); |
/* |
/* |
* negative deltas are xrun notifications for internal uses |
* negative deltas are xrun notifications for internal uses |
* only. Dont generate a packet for this, the client will be |
* only. Dont generate a packet for this, the client will be |
* notified later. |
* notified later. |
*/ |
*/ |
if (delta <= 0) |
if (delta < 0) |
return; |
return; |
|
f->tickpending++; |
for (;;) { |
for (;;) { |
if (!sock_write(f)) |
if (!sock_write(f)) |
break; |
break; |
|
|
f->xrun = AMSG_IGNORE; |
f->xrun = AMSG_IGNORE; |
f->bufsz = dev_bufsz; |
f->bufsz = dev_bufsz; |
f->round = dev_round; |
f->round = dev_round; |
f->odelta = f->idelta = 0; |
f->delta = 0; |
|
f->tickpending = 0; |
f->maxweight = maxweight; |
f->maxweight = maxweight; |
f->vol = ADATA_UNIT; |
f->vol = ADATA_UNIT; |
|
|
|
|
if (f->mode & AMSG_PLAY) { |
if (f->mode & AMSG_PLAY) { |
rbuf = abuf_new(f->bufsz, &f->rpar); |
rbuf = abuf_new(f->bufsz, &f->rpar); |
aproc_setout(f->pipe.file.rproc, rbuf); |
aproc_setout(f->pipe.file.rproc, rbuf); |
f->odelta = 0; |
|
} |
} |
if (f->mode & AMSG_REC) { |
if (f->mode & AMSG_REC) { |
wbuf = abuf_new(f->bufsz, &f->wpar); |
wbuf = abuf_new(f->bufsz, &f->wpar); |
aproc_setin(f->pipe.file.wproc, wbuf); |
aproc_setin(f->pipe.file.wproc, wbuf); |
f->idelta = 0; |
|
} |
} |
|
f->delta = 0; |
|
f->tickpending = 0; |
|
|
DPRINTF("sock_allocbuf: %p, using %u frames buffer\n", f, f->bufsz); |
DPRINTF("sock_allocbuf: %p, using %u frames buffer\n", f, f->bufsz); |
|
|
|
|
{ |
{ |
struct aproc *p; |
struct aproc *p; |
struct abuf *ibuf; |
struct abuf *ibuf; |
int *pdelta; |
|
|
|
/* |
/* |
* if pos changed, build a MOVE message |
* if pos changed, build a MOVE message |
*/ |
*/ |
pdelta = (f->mode & AMSG_REC) ? &f->idelta : &f->odelta; |
if (f->tickpending && f->delta >= 0) { |
if ((f->pstate == SOCK_RUN && *pdelta > 0) || |
DPRINTFN(4, "sock_buildmsg: %p: POS: %d\n", f, f->delta); |
(f->pstate == SOCK_START && *pdelta < 0)) { |
|
DPRINTFN(4, "sock_buildmsg: %p: POS: %d\n", f, *pdelta); |
|
AMSG_INIT(&f->wmsg); |
AMSG_INIT(&f->wmsg); |
f->wmsg.cmd = AMSG_MOVE; |
f->wmsg.cmd = AMSG_MOVE; |
f->wmsg.u.ts.delta = *pdelta; |
f->wmsg.u.ts.delta = f->delta; |
*pdelta = 0; |
|
f->wtodo = sizeof(struct amsg); |
f->wtodo = sizeof(struct amsg); |
f->wstate = SOCK_WMSG; |
f->wstate = SOCK_WMSG; |
|
f->delta = 0; |
|
f->tickpending = 0; |
return 1; |
return 1; |
} |
} |
|
|