mirror of https://github.com/ericonr/sndio.git
Add audio controls in dev_open(), not dev_open_do()
This commit is contained in:
parent
e15f9cc366
commit
a4ac7781fd
50
sndiod/dev.c
50
sndiod/dev.c
|
@ -1049,9 +1049,6 @@ dev_adjpar(struct dev *d, int mode,
|
||||||
int
|
int
|
||||||
dev_open_do(struct dev *d)
|
dev_open_do(struct dev *d)
|
||||||
{
|
{
|
||||||
int i, gunit;
|
|
||||||
struct ctl *c;
|
|
||||||
|
|
||||||
if (!dev_sio_open(d)) {
|
if (!dev_sio_open(d)) {
|
||||||
if (log_level >= 1) {
|
if (log_level >= 1) {
|
||||||
dev_log(d);
|
dev_log(d);
|
||||||
|
@ -1113,6 +1110,31 @@ dev_open_do(struct dev *d)
|
||||||
log_putu(d->round);
|
log_putu(d->round);
|
||||||
log_puts(" frames\n");
|
log_puts(" frames\n");
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Reset parameters and open the device.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
dev_open(struct dev *d)
|
||||||
|
{
|
||||||
|
int i, gunit;
|
||||||
|
struct ctl *c;
|
||||||
|
|
||||||
|
d->mode = d->reqmode;
|
||||||
|
d->round = d->reqround;
|
||||||
|
d->bufsz = d->reqbufsz;
|
||||||
|
d->rate = d->reqrate;
|
||||||
|
d->pchan = d->reqpchan;
|
||||||
|
d->rchan = d->reqrchan;
|
||||||
|
d->par = d->reqpar;
|
||||||
|
if (d->pchan == 0)
|
||||||
|
d->pchan = 2;
|
||||||
|
if (d->rchan == 0)
|
||||||
|
d->rchan = 2;
|
||||||
|
if (!dev_open_do(d))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1144,28 +1166,6 @@ dev_open_do(struct dev *d)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Reset parameters and open the device.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
dev_open(struct dev *d)
|
|
||||||
{
|
|
||||||
d->mode = d->reqmode;
|
|
||||||
d->round = d->reqround;
|
|
||||||
d->bufsz = d->reqbufsz;
|
|
||||||
d->rate = d->reqrate;
|
|
||||||
d->pchan = d->reqpchan;
|
|
||||||
d->rchan = d->reqrchan;
|
|
||||||
d->par = d->reqpar;
|
|
||||||
if (d->pchan == 0)
|
|
||||||
d->pchan = 2;
|
|
||||||
if (d->rchan == 0)
|
|
||||||
d->rchan = 2;
|
|
||||||
if (!dev_open_do(d))
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Force all slots to exit
|
* Force all slots to exit
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue