version 1.5, 2010/05/02 11:54:26 |
version 1.6, 2010/06/04 06:15:28 |
|
|
struct aparams *ipar, struct aparams *opar, |
struct aparams *ipar, struct aparams *opar, |
unsigned *bufsz, unsigned *round) |
unsigned *bufsz, unsigned *round) |
{ |
{ |
|
char *siopath; |
struct sio_par par; |
struct sio_par par; |
struct sio_hdl *hdl; |
struct sio_hdl *hdl; |
struct siofile *f; |
struct siofile *f; |
unsigned mode = *rmode; |
unsigned mode = *rmode; |
|
|
hdl = sio_open(path, mode, 1); |
siopath = (strcmp(path, "default") == 0) ? NULL : path; |
|
hdl = sio_open(siopath, mode, 1); |
if (hdl == NULL) { |
if (hdl == NULL) { |
if (mode != (SIO_PLAY | SIO_REC)) |
if (mode != (SIO_PLAY | SIO_REC)) |
return NULL; |
return NULL; |
hdl = sio_open(path, SIO_PLAY, 1); |
hdl = sio_open(siopath, SIO_PLAY, 1); |
if (hdl != NULL) |
if (hdl != NULL) |
mode = SIO_PLAY; |
mode = SIO_PLAY; |
else { |
else { |
hdl = sio_open(path, SIO_REC, 1); |
hdl = sio_open(siopath, SIO_REC, 1); |
if (hdl != NULL) |
if (hdl != NULL) |
mode = SIO_REC; |
mode = SIO_REC; |
else |
else |
|
|
*rmode = mode; |
*rmode = mode; |
*bufsz = par.bufsz; |
*bufsz = par.bufsz; |
*round = par.round; |
*round = par.round; |
if (path == NULL) |
|
path = "default"; |
|
f = (struct siofile *)file_new(ops, path, sio_nfds(hdl)); |
f = (struct siofile *)file_new(ops, path, sio_nfds(hdl)); |
if (f == NULL) |
if (f == NULL) |
goto bad_close; |
goto bad_close; |