diff --git a/sndiod/dev.c b/sndiod/dev.c index b18b8c4..ed88446 100644 --- a/sndiod/dev.c +++ b/sndiod/dev.c @@ -61,6 +61,7 @@ void dev_adjpar(struct dev *, int, int, int); int dev_open_do(struct dev *); int dev_open(struct dev *); void dev_exitall(struct dev *); +void dev_close_do(struct dev *); void dev_close(struct dev *); int dev_ref(struct dev *); void dev_unref(struct dev *); @@ -1141,7 +1142,7 @@ dev_exitall(struct dev *d) * ensure buffers are drained */ void -dev_close(struct dev *d) +dev_close_do(struct dev *d) { #ifdef DEBUG if (log_level >= 3) { @@ -1150,7 +1151,6 @@ dev_close(struct dev *d) } #endif d->pstate = DEV_CFG; - dev_exitall(d); dev_sio_close(d); if (d->mode & MODE_PLAY) { if (d->encbuf != NULL) @@ -1164,6 +1164,16 @@ dev_close(struct dev *d) } } +/* + * Close the device and exit all slots + */ +void +dev_close(struct dev *d) +{ + dev_exitall(d); + dev_close_do(d); +} + int dev_ref(struct dev *d) {