diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-10-10 11:19:56 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-10-10 11:19:56 +0000 |
commit | 96c0b302f5614a79f67e544adeb96beb701414c8 (patch) | |
tree | 8d21fefbaa1a4930cc15a11997b953a801ce772c /lib | |
parent | cb36f44f92411a65728848159782878a9fe5f61b (diff) |
at initialization of sun devices, use sio_setpar(3) instead of
AUDIO_SETINFO() to set the initial parameters, since AUDIO_SETINFO()
can fail.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libsndio/sun.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/libsndio/sun.c b/lib/libsndio/sun.c index 192b8449348..ac06f61c4e1 100644 --- a/lib/libsndio/sun.c +++ b/lib/libsndio/sun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sun.c,v 1.22 2009/10/10 08:34:12 ratchov Exp $ */ +/* $OpenBSD: sun.c,v 1.23 2009/10/10 11:19:55 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org> * @@ -346,7 +346,6 @@ sio_open_sun(const char *str, unsigned mode, int nbio) { int fd, flags, fullduplex; struct sun_hdl *hdl; - struct audio_info aui; struct sio_par par; char path[PATH_MAX]; @@ -385,17 +384,17 @@ sio_open_sun(const char *str, unsigned mode, int nbio) } } hdl->fd = fd; - AUDIO_INITINFO(&aui); - if (hdl->sio.mode & SIO_PLAY) - aui.play.encoding = AUDIO_ENCODING_SLINEAR; - if (hdl->sio.mode & SIO_REC) - aui.record.encoding = AUDIO_ENCODING_SLINEAR; - if (ioctl(hdl->fd, AUDIO_SETINFO, &aui) < 0) { - DPERROR("sio_open_sun: setinfo"); - goto bad_close; - } + + /* + * Default parameters may not be compatible with libsndio (eg. mulaw + * encodings, different playback and recording parameters, etc...), so + * set parameters to a random value. If the requested parameters are + * not supported by the device, then sio_setpar() will pick supported + * ones. + */ sio_initpar(&par); par.rate = 48000; + par.le = SIO_LE_NATIVE; par.sig = 1; par.bits = 16; par.appbufsz = 1200; |