>From my limited testing it appears that sio_getcap() fails if audio
device does not have identical recording and playback capabilities
(examples at the end). If that is indeed the case, could it possibly be
mentioned in the man page somewhere? Perhaps something like:
Index: sio_open.3
===================================================================
RCS file: /build/openbsd/cvs/src/lib/libsndio/sio_open.3,v
retrieving revision 1.46
diff -u -p -r1.46 sio_open.3
--- sio_open.3 3 Jan 2017 20:29:28 -0000 1.46
+++ sio_open.3 7 May 2017 17:22:31 -0000
@@ -285,6 +285,17 @@ parameter combinations in advance can us
.Fn sio_getcap
function.
.Pp
+.Fn sio_getcap
+function can return different results based on whether
+.Dv SIO_PLAY
+or
+.Dv SIO_REC
+mode was selected.
+It can fail for the device with differing recording and
+playback capabilities opened in
+.Dv SIO_PLAY | SIO_REC
+mode.
+.Pp
The
.Vt sio_cap
structure contains the list of parameter configurations.
Examples that I am retrieving with sio_getpar() and sio_getcap()
with a program similar to src/regress/lib/libsndio/cap/cap.c:
rsnd/0 (play) parameters: s24le/48000, 2 play/2 rec channels
rsnd/0 (rec) parameters: s16le/48000, 2 play/2 rec channels
rsnd/0 (play+rec) parameters: s16le/48000, 2 play/2 rec channels
rsnd/0 (play) capabilities:
Configuration 1 out of 1:
Encodings: s16le s24le
Rates: 44100 48000 96000
Recording channels:
Playback channels: 2
rsnd/0 (rec) capabilities:
Configuration 1 out of 1:
Encodings: s16le
Rates: 44100 48000 96000
Recording channels: 2
Playback channels:
rsnd/0 (play+rec) capabilities:
Error getting capabilities.
but on a different system with better audio hardware it succeeds:
rsnd/0 (play) parameters: s24le/48000, 2 play/2 rec channels
rsnd/0 (rec) parameters: s24le/48000, 2 play/2 rec channels
rsnd/0 (play+rec) parameters: s24le/48000, 2 play/2 rec channels
rsnd/0 (play) capabilities:
Configuration 1 out of 1:
Encodings: s16le s24le
Rates: 44100 48000 88200 96000
Recording channels:
Playback channels: 2 4 6 8 10
rsnd/0 (rec) capabilities:
Configuration 1 out of 1:
Encodings: s16le s24le
Rates: 44100 48000 88200 96000
Recording channels: 2
Playback channels:
rsnd/0 (play+rec) capabilities:
Configuration 1 out of 1:
Encodings: s16le s24le
Rates: 44100 48000 88200 96000
Recording channels: 2
Playback channels: 2 4 6 8 10