summaryrefslogtreecommitdiff
path: root/usr.bin/sndiod
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2013-05-05 20:42:54 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2013-05-05 20:42:54 +0000
commit64eb0392759e97e9a0b33cfef74e98a4ae18db44 (patch)
tree05553018a9b6dacf08ae7607ed560bbdc7930fdc /usr.bin/sndiod
parent492349577f0f52f5e85085d90c540883d58845f6 (diff)
Initialize channel ranges of new slots to full sub-device channels.
Fixes wrong channel mappings when the client specifies no channels. Found by Dimitri Sokolyuk <sokolyuk at gmail.com>, thanks!
Diffstat (limited to 'usr.bin/sndiod')
-rw-r--r--usr.bin/sndiod/dev.c15
-rw-r--r--usr.bin/sndiod/sock.c19
2 files changed, 17 insertions, 17 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c
index 9107a91b04e..38b42828229 100644
--- a/usr.bin/sndiod/dev.c
+++ b/usr.bin/sndiod/dev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev.c,v 1.5 2013/05/05 09:50:21 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.6 2013/05/05 20:42:53 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -1559,21 +1559,22 @@ found:
return 0;
}
s->mode = mode;
- s->par = d->par;
+ aparams_init(&s->par);
if (s->mode & MODE_PLAY) {
- s->mix.slot_cmin = 0;
- s->mix.slot_cmax = d->pchan - 1;
+ s->mix.slot_cmin = s->mix.dev_cmin = 0;
+ s->mix.slot_cmax = s->mix.dev_cmax = d->pchan - 1;
}
if (s->mode & MODE_RECMASK) {
- s->sub.slot_cmin = 0;
- s->sub.slot_cmax = ((s->mode & MODE_MON) ?
- d->pchan : d->rchan) - 1;
+ s->sub.slot_cmin = s->sub.dev_cmin = 0;
+ s->sub.slot_cmax = s->sub.dev_cmax =
+ ((s->mode & MODE_MON) ? d->pchan : d->rchan) - 1;
}
s->xrun = XRUN_IGNORE;
s->dup = 0;
s->appbufsz = d->bufsz;
s->round = d->round;
s->rate = d->rate;
+ s->mix.maxweight = ADATA_UNIT;
dev_midi_slotdesc(d, s);
dev_midi_vol(d, s);
return s;
diff --git a/usr.bin/sndiod/sock.c b/usr.bin/sndiod/sock.c
index b909e08cea3..d4bc4928ec8 100644
--- a/usr.bin/sndiod/sock.c
+++ b/usr.bin/sndiod/sock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sock.c,v 1.5 2012/12/06 08:13:04 ratchov Exp $ */
+/* $OpenBSD: sock.c,v 1.6 2013/05/05 20:42:53 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
@@ -670,13 +670,13 @@ sock_setpar(struct sock *f)
if (log_level >= 3) {
sock_log(f);
log_puts(": recording channels ");
- log_putu(s->sub.slot_cmin);
- log_puts(":");
- log_putu(s->sub.slot_cmax);
- log_puts(" -> ");
log_putu(s->sub.dev_cmin);
log_puts(":");
log_putu(s->sub.dev_cmax);
+ log_puts(" -> ");
+ log_putu(s->sub.slot_cmin);
+ log_puts(":");
+ log_putu(s->sub.slot_cmax);
log_puts("\n");
}
#endif
@@ -907,14 +907,13 @@ sock_hello(struct sock *f)
if (s == NULL)
return 0;
f->midi = NULL;
- aparams_init(&s->par);
if (s->mode & MODE_PLAY) {
- s->mix.slot_cmin = f->opt->pmin;
- s->mix.slot_cmax = f->opt->pmax;
+ s->mix.slot_cmin = s->mix.dev_cmin = f->opt->pmin;
+ s->mix.slot_cmax = s->mix.dev_cmax = f->opt->pmax;
}
if (s->mode & MODE_RECMASK) {
- s->sub.slot_cmin = f->opt->rmin;
- s->sub.slot_cmax = f->opt->rmax;
+ s->sub.slot_cmin = s->sub.dev_cmin = f->opt->rmin;
+ s->sub.slot_cmax = s->sub.dev_cmax = f->opt->rmax;
}
if (f->opt->mmc) {
s->xrun = XRUN_SYNC;