mirror of https://github.com/ericonr/sndio.git
disable playing and monitoring at the same time and append
slots using MODE_MON at the end of the slot list, so that data to monitor is produced (by other slots) before the monitoring slot is consuming it
This commit is contained in:
parent
e2beb728b4
commit
d00caaaf96
22
sndiod/dev.c
22
sndiod/dev.c
|
@ -1617,6 +1617,7 @@ slot_setvol(struct slot *s, unsigned int vol)
|
||||||
void
|
void
|
||||||
slot_attach(struct slot *s)
|
slot_attach(struct slot *s)
|
||||||
{
|
{
|
||||||
|
struct slot **ps;
|
||||||
struct dev *d = s->dev;
|
struct dev *d = s->dev;
|
||||||
unsigned int slot_nch, dev_nch;
|
unsigned int slot_nch, dev_nch;
|
||||||
long long pos;
|
long long pos;
|
||||||
|
@ -1660,12 +1661,27 @@ slot_attach(struct slot *s)
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if ((s->mode & d->mode) != s->mode) {
|
if ((s->mode & d->mode) != s->mode) {
|
||||||
slot_log(s);
|
slot_log(s);
|
||||||
log_puts(": mode beyond device mode, not attaching\n");
|
log_puts(": mode beyond device mode\n");
|
||||||
panic();
|
panic();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
s->next = d->slot_list;
|
|
||||||
d->slot_list = s;
|
/*
|
||||||
|
* attach slot to the list
|
||||||
|
*/
|
||||||
|
ps = &d->slot_list;
|
||||||
|
if (s->mode & MODE_MON) {
|
||||||
|
/*
|
||||||
|
* attach slot at the end of the list as other slots
|
||||||
|
* must be processed first to produce the data to
|
||||||
|
* monitor
|
||||||
|
*/
|
||||||
|
while (*ps != NULL)
|
||||||
|
ps = &(*ps)->next;
|
||||||
|
}
|
||||||
|
s->next = *ps;
|
||||||
|
*ps = s;
|
||||||
|
|
||||||
s->skip = 0;
|
s->skip = 0;
|
||||||
if (s->mode & MODE_PLAY) {
|
if (s->mode & MODE_PLAY) {
|
||||||
slot_nch = s->mix.slot_cmax - s->mix.slot_cmin + 1;
|
slot_nch = s->mix.slot_cmax - s->mix.slot_cmin + 1;
|
||||||
|
|
|
@ -854,6 +854,13 @@ sock_hello(struct sock *f)
|
||||||
mode |= MODE_MON;
|
mode |= MODE_MON;
|
||||||
mode &= ~MODE_REC;
|
mode &= ~MODE_REC;
|
||||||
}
|
}
|
||||||
|
if ((mode & MODE_MON) && (mode & MODE_PLAY)) {
|
||||||
|
if (log_level >= 1) {
|
||||||
|
sock_log(f);
|
||||||
|
log_puts(": cannot play and monitor\n");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if ((mode & f->opt->mode) != mode) {
|
if ((mode & f->opt->mode) != mode) {
|
||||||
if (log_level >= 1) {
|
if (log_level >= 1) {
|
||||||
sock_log(f);
|
sock_log(f);
|
||||||
|
|
Loading…
Reference in New Issue