version 1.33, 2009/10/22 21:41:30 |
version 1.34, 2009/10/27 22:41:03 |
|
|
}; |
}; |
|
|
|
|
|
void sock_setvol(void *, unsigned); |
|
|
|
struct ctl_ops ctl_sockops = { |
|
sock_setvol, |
|
}; |
|
|
void |
void |
rsock_done(struct aproc *p) |
rsock_done(struct aproc *p) |
{ |
{ |
|
|
sock_reset(f); |
sock_reset(f); |
f->pipe.file.rproc = NULL; |
f->pipe.file.rproc = NULL; |
if (f->pipe.file.wproc) { |
if (f->pipe.file.wproc) { |
if (dev_midi && f->slot >= 0) |
if (f->slot >= 0) |
ctl_slotdel(dev_midi, f->slot); |
ctl_slotdel(dev_midi, f->slot); |
aproc_del(f->pipe.file.wproc); |
aproc_del(f->pipe.file.wproc); |
file_del(&f->pipe.file); |
file_del(&f->pipe.file); |
|
|
if (!sock_read(f)) |
if (!sock_read(f)) |
return 0; |
return 0; |
obuf = LIST_FIRST(&p->obuflist); |
obuf = LIST_FIRST(&p->obuflist); |
if (obuf) { |
if (obuf && f->pstate >= SOCK_RUN) { |
if (!abuf_flush(obuf)) |
if (!abuf_flush(obuf)) |
return 0; |
return 0; |
} |
} |
|
|
sock_reset(f); |
sock_reset(f); |
f->pipe.file.wproc = NULL; |
f->pipe.file.wproc = NULL; |
if (f->pipe.file.rproc) { |
if (f->pipe.file.rproc) { |
if (dev_midi && f->slot >= 0) |
if (f->slot >= 0) |
ctl_slotdel(dev_midi, f->slot); |
ctl_slotdel(dev_midi, f->slot); |
aproc_del(f->pipe.file.rproc); |
aproc_del(f->pipe.file.rproc); |
file_del(&f->pipe.file); |
file_del(&f->pipe.file); |
|
|
f->mode |= AMSG_REC; |
f->mode |= AMSG_REC; |
} |
} |
if (dev_midi) { |
if (dev_midi) { |
f->slot = ctl_slotnew(dev_midi, p->who, sock_setvol, f); |
f->slot = ctl_slotnew(dev_midi, p->who, &ctl_sockops, f); |
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 && |
|
ABUF_FULL(LIST_FIRST(&f->pipe.file.rproc->obuflist))) { |
|
aproc_del(f->pipe.file.rproc); |
|
return 0; |
|
} |
f->rstate = SOCK_RDATA; |
f->rstate = SOCK_RDATA; |
f->rtodo = m->u.data.size; |
f->rtodo = m->u.data.size; |
if (f->rtodo == 0) { |
if (f->rtodo == 0) { |
|
|
return 0; |
return 0; |
} |
} |
sock_setvol(f, m->u.vol.ctl); |
sock_setvol(f, m->u.vol.ctl); |
if (dev_midi && f->slot >= 0) |
if (f->slot >= 0) |
ctl_slotvol(dev_midi, f->slot, m->u.vol.ctl); |
ctl_slotvol(dev_midi, f->slot, m->u.vol.ctl); |
f->rtodo = sizeof(struct amsg); |
f->rtodo = sizeof(struct amsg); |
f->rstate = SOCK_RMSG; |
f->rstate = SOCK_RMSG; |