version 1.34, 2009/10/27 22:41:03 |
version 1.35, 2009/11/03 21:31:37 |
|
|
|
|
|
|
void sock_setvol(void *, unsigned); |
void sock_setvol(void *, unsigned); |
|
void sock_startreq(void *); |
|
|
struct ctl_ops ctl_sockops = { |
struct ctl_ops ctl_sockops = { |
sock_setvol, |
sock_setvol, |
|
sock_startreq |
}; |
}; |
|
|
void |
void |
|
|
struct abuf *rbuf, *wbuf; |
struct abuf *rbuf, *wbuf; |
|
|
f->pstate = SOCK_INIT; |
f->pstate = SOCK_INIT; |
|
wbuf = LIST_FIRST(&f->pipe.file.wproc->ibuflist); |
rbuf = LIST_FIRST(&f->pipe.file.rproc->obuflist); |
rbuf = LIST_FIRST(&f->pipe.file.rproc->obuflist); |
|
if (rbuf || wbuf) |
|
ctl_slotstop(dev_midi, f->slot); |
if (rbuf) |
if (rbuf) |
abuf_eof(rbuf); |
abuf_eof(rbuf); |
wbuf = LIST_FIRST(&f->pipe.file.wproc->ibuflist); |
|
if (wbuf) |
if (wbuf) |
abuf_hup(wbuf); |
abuf_hup(wbuf); |
f->tickpending = 0; |
f->tickpending = 0; |
|
|
f->delta = 0; |
f->delta = 0; |
f->tickpending = 0; |
f->tickpending = 0; |
f->pstate = SOCK_START; |
f->pstate = SOCK_START; |
if (!(f->mode & AMSG_PLAY)) |
if (!(f->mode & AMSG_PLAY) && ctl_slotstart(dev_midi, f->slot)) |
(void)sock_attach(f, 0); |
(void)sock_attach(f, 0); |
} |
} |
|
|
|
|
} |
} |
|
|
/* |
/* |
|
* Attach the stream. Callback invoked when MMC start |
|
*/ |
|
void |
|
sock_startreq(void *arg) |
|
{ |
|
struct sock *f = (struct sock *)arg; |
|
|
|
(void)sock_attach(f, 0); |
|
} |
|
|
|
/* |
* Attach play and/or record buffers to dev_mix and/or dev_sub. |
* Attach play and/or record buffers to dev_mix and/or dev_sub. |
*/ |
*/ |
int |
int |
|
|
{ |
{ |
switch (f->pstate) { |
switch (f->pstate) { |
case SOCK_START: |
case SOCK_START: |
(void)sock_attach(f, 1); |
if (ctl_slotstart(dev_midi, f->slot)) { |
f->pstate = SOCK_RUN; |
(void)sock_attach(f, 1); |
|
f->pstate = SOCK_RUN; |
|
} |
/* PASSTHROUGH */ |
/* PASSTHROUGH */ |
case SOCK_RUN: |
case SOCK_RUN: |
sock_freebuf(f); |
sock_freebuf(f); |
|
|
return 0; |
return 0; |
} |
} |
f->xrun = p->xrun; |
f->xrun = p->xrun; |
|
if (f->opt->mmc && f->xrun == AMSG_IGNORE) |
|
f->xrun = AMSG_SYNC; |
} |
} |
if (AMSG_ISSET(p->bufsz)) { |
if (AMSG_ISSET(p->bufsz)) { |
/* |
/* |
|
|
f->wpar = f->opt->wpar; |
f->wpar = f->opt->wpar; |
if (dev_mix) |
if (dev_mix) |
f->rpar = f->opt->rpar; |
f->rpar = f->opt->rpar; |
|
if (f->opt->mmc) |
|
f->xrun = AMSG_SYNC; |
if ((p->proto & ~(AMSG_PLAY | AMSG_REC)) != 0 || |
if ((p->proto & ~(AMSG_PLAY | AMSG_REC)) != 0 || |
(p->proto & (AMSG_PLAY | AMSG_REC)) == 0) { |
(p->proto & (AMSG_PLAY | AMSG_REC)) == 0) { |
return 0; |
return 0; |
|
|
f->mode |= AMSG_REC; |
f->mode |= AMSG_REC; |
} |
} |
if (dev_midi) { |
if (dev_midi) { |
f->slot = ctl_slotnew(dev_midi, p->who, &ctl_sockops, f); |
f->slot = ctl_slotnew(dev_midi, |
|
p->who, &ctl_sockops, f, |
|
f->opt->mmc); |
if (f->slot < 0) { |
if (f->slot < 0) { |
return 0; |
return 0; |
} |
} |
|
|
aproc_del(f->pipe.file.rproc); |
aproc_del(f->pipe.file.rproc); |
return 0; |
return 0; |
} |
} |
if (f->pstate == SOCK_START) |
if (f->pstate == SOCK_START && |
|
ctl_slotstart(dev_midi, f->slot)) |
(void)sock_attach(f, 1); |
(void)sock_attach(f, 1); |
sock_freebuf(f); |
sock_freebuf(f); |
AMSG_INIT(m); |
AMSG_INIT(m); |
|
|
f->rstate = SOCK_RMSG; |
f->rstate = SOCK_RMSG; |
f->rtodo = sizeof(struct amsg); |
f->rtodo = sizeof(struct amsg); |
} |
} |
if (f->pstate == SOCK_START) |
/* |
|
* XXX: have to way that the buffer is full before starting |
|
*/ |
|
if (f->pstate == SOCK_START && ctl_slotstart(dev_midi, f->slot)) |
(void)sock_attach(f, 0); |
(void)sock_attach(f, 0); |
break; |
break; |
case SOCK_RRET: |
case SOCK_RRET: |