1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
|
.\" $OpenBSD: sio_open.3,v 1.30 2011/12/09 14:38:09 ratchov Exp $
.\"
.\" Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: December 9 2011 $
.Dt SIO_OPEN 3
.Os
.Sh NAME
.Nm sio_open ,
.Nm sio_close ,
.Nm sio_setpar ,
.Nm sio_getpar ,
.Nm sio_getcap ,
.Nm sio_start ,
.Nm sio_stop ,
.Nm sio_read ,
.Nm sio_write ,
.Nm sio_onmove ,
.Nm sio_nfds ,
.Nm sio_pollfd ,
.Nm sio_revents ,
.Nm sio_eof ,
.Nm sio_setvol ,
.Nm sio_onvol ,
.Nm sio_initpar
.Nd interface to bidirectional audio streams
.Sh SYNOPSIS
.Fd #include <sndio.h>
.Ft "struct sio_hdl *"
.Fn "sio_open" "const char *name" "unsigned mode" "int nbio_flag"
.Ft "void"
.Fn "sio_close" "struct sio_hdl *hdl"
.Ft "int"
.Fn "sio_setpar" "struct sio_hdl *hdl" "struct sio_par *par"
.Ft "int"
.Fn "sio_getpar" "struct sio_hdl *hdl" "struct sio_par *par"
.Ft "int"
.Fn "sio_getcap" "struct sio_hdl *hdl" "struct sio_cap *cap"
.Ft "int"
.Fn "sio_start" "struct sio_hdl *hdl"
.Ft "int"
.Fn "sio_stop" "struct sio_hdl *hdl"
.Ft "size_t"
.Fn "sio_read" "struct sio_hdl *hdl" "void *addr" "size_t nbytes"
.Ft "size_t"
.Fn "sio_write" "struct sio_hdl *hdl" "const void *addr" "size_t nbytes"
.Ft "void"
.Fn "sio_onmove" "struct sio_hdl *hdl" "void (*cb)(void *arg, int delta)" "void *arg"
.Ft "int"
.Fn "sio_nfds" "struct sio_hdl *hdl"
.Ft "int"
.Fn "sio_pollfd" "struct sio_hdl *hdl" "struct pollfd *pfd" "int events"
.Ft "int"
.Fn "sio_revents" "struct sio_hdl *hdl" "struct pollfd *pfd"
.Ft "int"
.Fn "sio_eof" "struct sio_hdl *hdl"
.Ft "int"
.Fn "sio_setvol" "struct sio_hdl *hdl" "unsigned vol"
.Ft "int"
.Fn "sio_onvol" "struct sio_hdl *hdl" "void (*cb)(void *arg, unsigned vol)" "void *arg"
.Ft "void"
.Fn "sio_initpar" "struct sio_par *par"
.\"Fd #define SIO_BPS(bits)
.\"Fd #define SIO_LE_NATIVE
.Sh DESCRIPTION
The
.Nm sndio
library allows user processes to access
.Xr audio 4
hardware and the
.Xr sndiod 1
audio server in a uniform way.
It supports full-duplex operation, and when
used with the
.Xr sndiod 1
server it supports resampling and format
conversions on the fly.
.Ss Opening and closing an audio stream
First the application must call the
.Fn sio_open
function to obtain a handle representing the newly created stream;
later it will be passed as the
.Ar hdl
argument of most other functions.
The
.Fn sio_open
function first tries to connect to the
.Xr sndiod 1
audio server.
If that fails, it then tries to use the
.Xr audio 4
hardware device.
The
.Ar name
parameter gives the device string discussed in
.Xr sndio 7 .
In most cases it should be set to NULL to allow
the user to select it using the
.Ev AUDIODEVICE
environment variable.
.Pp
The
.Ar mode
parameter gives the direction of the stream.
The following are supported:
.Bl -tag -width "SIO_PLAY | SIO_REC"
.It SIO_PLAY
The stream is play-only; data written to the stream will be played
by the hardware.
.It SIO_REC
The stream is record-only; recorded samples by the hardware
must be read from the stream.
.It SIO_PLAY | SIO_REC
The stream plays and records synchronously; this means that
the n-th recorded sample was physically sampled exactly when
the n-th played sample was actually played.
.El
.Pp
If the
.Ar nbio_flag
argument is true (i.e. non-zero), then the
.Fn sio_read
and
.Fn sio_write
functions (see below) will be non-blocking.
.Pp
The
.Fn sio_close
function closes the stream and frees all allocated resources
associated with the
.Nm libsndio
handle.
If the stream is not stopped it will be stopped first as if
.Fn sio_stop
is called.
.Ss Negotiating audio parameters
Audio streams always use linear interleaved encoding.
A frame consists of one sample for each channel in the stream.
For example, a 16-bit stereo stream has two samples per frame
and, typically, two bytes per sample (thus 4 bytes per frame).
.Pp
The set of parameters of the stream that can be controlled
is given by the following structure:
.Bd -literal
struct sio_par {
unsigned bits; /* bits per sample */
unsigned bps; /* bytes per sample */
unsigned sig; /* 1 = signed, 0 = unsigned */
unsigned le; /* 1 = LE, 0 = BE byte order */
unsigned msb; /* 1 = MSB, 0 = LSB aligned */
unsigned rchan; /* number channels for recording */
unsigned pchan; /* number channels for playback */
unsigned rate; /* frames per second */
unsigned appbufsz; /* minimum buffer size without xruns */
unsigned bufsz; /* end-to-end buffer size (read-only) */
unsigned round; /* optimal buffer size divisor */
#define SIO_IGNORE 0 /* pause during xrun */
#define SIO_SYNC 1 /* resync after xrun */
#define SIO_ERROR 2 /* terminate on xrun */
unsigned xrun; /* what to do on overrun/underrun */
};
.Ed
.Pp
The parameters are as follows:
.Bl -tag -width "appbufsz"
.It Va bits
Number of bits per sample: must be between 1 and 32.
.It Va bps
Bytes per samples; if specified, it must be large enough to hold all bits.
By default it's set to the smallest power of two large enough to hold
.Va bits .
.It Va sig
If set (i.e. non-zero) then the samples are signed, else unsigned.
.It Va le
If set, then the byte order is little endian, else big endian;
it's meaningful only if
.Va bps
\*(Gt 1.
.It Va msb
If set, then the
.Va bits
bits are aligned in the packet to the most significant bit
(i.e. lower bits are padded),
else to the least significant bit
(i.e. higher bits are padded);
it's meaningful only if
.Va bits
\*(Lt
.Va bps
* 8.
.It Va rchan
The number of recorded channels; meaningful only if
.Va SIO_REC
mode was selected.
.It Va pchan
The number of played channels; meaningful only if
.Va SIO_PLAY
mode was selected.
.It Va rate
The sampling frequency in Hz.
.It Va bufsz
The maximum number of frames that may be buffered.
This parameter takes into account any buffers, and
can be used for latency calculations.
It is read-only.
.It Va appbufsz
Size of the buffer in frames the application must maintain non-empty
(on the play end) or non-full (on the record end) by calling
.Fn sio_write
or
.Fn sio_read
fast enough to avoid overrun or underrun conditions.
The audio subsystem may use additional buffering, thus this
parameter cannot be used for latency calculations.
.It Va round
Optimal number of frames that the application buffers
should be a multiple of, to get best performance.
Applications can use this parameter to round their block size.
.It Va xrun
The action when the client doesn't accept
recorded data or doesn't provide data to play fast enough;
it can be set to one of the
.Va SIO_IGNORE ,
.Va SIO_SYNC
or
.Va SIO_ERROR
constants.
.El
.Pp
The following approach is recommended to negotiate parameters of the stream:
.Bl -bullet
.It
Initialize a
.Va sio_par
structure using
.Fn sio_initpar
and fill it with
the desired parameters.
If the application supports any value for a given parameter,
then the corresponding parameter should be left unset.
Then call
.Fn sio_setpar
to request the stream to use them.
.It
Call
.Fn sio_getpar
to retrieve the actual parameters of the stream
and check that they are usable.
If they are not, then fail or set up a conversion layer.
Sometimes the rate set can be slightly different to what was requested.
A difference of about 0.5% is not audible and should be ignored.
.El
.Pp
Parameters cannot be changed while the stream is in a waiting state;
if
.Fn sio_start
has been called,
.Fn sio_stop
must be called before parameters can be changed.
.Pp
If
.Nm libsndio
is used to connect to the
.Xr sndiod 1
server, a transparent emulation layer will
automatically be set up, and in this case any
parameters are supported.
.Pp
To ease filling the
.Va sio_par
structure, the
following macros can be used:
.Bl -tag -width "SIO_BPS(bits)"
.It "SIO_BPS(bits)"
Return the smallest value for
.Va bps
that is a power of two and that is large enough to
hold
.Va bits .
.It "SIO_LE_NATIVE"
Can be used to set the
.Va le
parameter when native byte order is required.
.El
.Ss Getting stream capabilities
There's no way to get an exhaustive list of all parameter
combinations the stream supports.
Applications that need to have a set of working
parameter combinations in advance can use the
.Fn sio_getcap
function.
.Pp
The
.Va sio_cap
structure contains the list of parameter configurations.
Each configuration contains multiple parameter sets.
The application must examine all configurations, and
choose its parameter set from
.Em one
of the configurations.
Parameters of different configurations
.Em are not
usable together.
.Bd -literal
struct sio_cap {
struct sio_enc { /* allowed encodings */
unsigned bits;
unsigned bps;
unsigned sig;
unsigned le;
unsigned msb;
} enc[SIO_NENC];
unsigned rchan[SIO_NCHAN]; /* allowed rchans */
unsigned pchan[SIO_NCHAN]; /* allowed pchans */
unsigned rate[SIO_NRATE]; /* allowed rates */
unsigned nconf; /* num. of confs[] */
struct sio_conf {
unsigned enc; /* bitmask of enc[] indexes */
unsigned rchan; /* bitmask of rchan[] indexes */
unsigned pchan; /* bitmask of pchan[] indexes */
unsigned rate; /* bitmask of rate[] indexes */
} confs[SIO_NCONF];
};
.Ed
.Pp
The parameters are as follows:
.Bl -tag -width "rchan[SIO_NCHAN]"
.It Va enc[SIO_NENC]
Array of supported encodings.
The tuple of
.Va bits ,
.Va bps ,
.Va sig ,
.Va le
and
.Va msb
parameters are usable in the corresponding parameters
of the
.Va sio_par
structure.
.It Va rchan[SIO_NCHAN]
Array of supported channel numbers for recording usable
in the
.Va sio_par
structure.
.It Va pchan[SIO_NCHAN]
Array of supported channel numbers for playback usable
in the
.Va sio_par
structure.
.It Va rate[SIO_NRATE]
Array of supported sample rates usable
in the
.Va sio_par
structure.
.It Va nconf
Number of different configurations available, i.e. number
of filled elements of the
.Va confs[]
array.
.It Va confs[SIO_NCONF]
Array of available configurations.
Each configuration contains bitmasks indicating which
elements of the above parameter arrays are valid for the
given configuration.
For instance, if the second bit of
.Va rate
is set, in the
.Va sio_conf
structure, then the second element of the
.Va rate[SIO_NRATE]
array of the
.Va sio_cap
structure is valid for this configuration.
.El
.Ss Starting and stopping the stream
The
.Fn sio_start
function puts the stream in a waiting state:
the stream will wait for playback data to be provided
(using the
.Fn sio_write
function).
Once enough data is queued to ensure that play buffers
will not underrun, actual playback is started automatically.
If record mode only is selected, then recording starts
immediately.
In full-duplex mode, playback and recording will start
synchronously as soon as enough data to play is available.
.Pp
The
.Fn sio_stop
function stops playback and recording and puts the audio subsystem
in the same state as after
.Fn sio_open
is called.
Samples in the play buffers are not discarded, and will continue to
be played after
.Fn sio_stop
returns.
If samples to play are queued but playback hasn't started yet
then playback is forced immediately; the stream will actually stop
once the buffer is drained.
.Ss Playing and recording
When record mode is selected, the
.Fn sio_read
function must be called to retrieve recorded data; it must be called
often enough to ensure that internal buffers will not overrun.
It will store at most
.Ar nbytes
bytes at the
.Ar addr
location and return the number of bytes stored.
Unless the
.Ar nbio_flag
flag is set, it will block until data becomes available and
will return zero only on error.
.Pp
Similarly, when play mode is selected, the
.Fn sio_write
function must be called to provide data to play.
Unless the
.Ar nbio_flag
is set,
.Fn sio_write
will block until the requested amount of data is written.
.Ss Non-blocking mode operation
If the
.Ar nbio_flag
is set on
.Fn sio_open ,
then the
.Fn sio_read
and
.Fn sio_write
functions will never block; if no data is available, they will
return zero immediately.
.Pp
Note that non-blocking mode must be used on bidirectional streams.
For instance, if recording is blocked in
.Fn sio_read
then, even if samples can be played,
.Fn sio_write
cannot be called and the play buffers may underrun.
.Pp
To avoid busy loops when non-blocking mode is used, the
.Xr poll 2
system call can be used to check if data can be
read from or written to the stream.
The
.Fn sio_pollfd
function fills the array
.Ar pfd
of
.Va pollfd
structures, used by
.Xr poll 2 ,
with
.Ar events ;
the latter is a bit-mask of
.Va POLLIN
and
.Va POLLOUT
constants; refer to
.Xr poll 2
for more details.
.Fn sio_pollfd
returns the number of
.Va pollfd
structures filled.
The
.Fn sio_revents
function returns the bit-mask set by
.Xr poll 2
in the
.Va pfd
array of
.Va pollfd
structures.
If
.Va POLLIN
is set,
.Fn sio_read
can be called without blocking.
If
.Va POLLOUT
is set,
.Fn sio_write
can be called without blocking.
POLLHUP may be set if an error occurs, even if
it is not selected with
.Fn sio_pollfd .
.Pp
The
.Fn sio_nfds
function returns the number of
.Va pollfd
structures the caller must preallocate in order to be sure
that
.Fn sio_pollfd
will never overrun.
.Ss Synchronizing non-audio events to the stream in real-time
In order to perform actions at precise positions of the stream,
such as displaying video in sync with the audio stream,
the application must be notified in real-time of the exact
position in the stream the hardware is processing.
.Pp
The
.Fn sio_onmove
function can be used to register the
.Va cb
callback function that will be called by the
.Nm sndio
library at regular time intervals to notify the application
the position in the stream changed.
The
.Va delta
argument contains the number of frames the hardware moved in the stream
since the last call of
.Va cb .
When the stream starts, the callback is invoked with a zero
.Va delta
argument.
The value of the
.Va arg
pointer is passed to the callback and can contain anything.
.Pp
If desired, the application can maintain the current position by
starting from zero (when
.Fn sio_start
is called) and adding to the current position
.Va delta
every time
.Fn cb
is called.
.Ss Measuring the latency and buffers usage
The playback latency is the delay it will take for the
frame just written to become audible, expressed in number of frames.
The exact playback
latency can be obtained by subtracting the current position
from the number of frames written.
Once playback is actually started (first sample audible)
the latency will never exceed the
.Va bufsz
parameter (see the sections above).
There's a phase during which
.Fn sio_write
only queues data;
once there's enough data, actual playback starts.
During this phase talking about latency is meaningless.
.Pp
In any cases, at most
.Va bufsz
frames are buffered.
This value takes into account all buffers,
including device, kernel and socket buffers.
The number of frames stored is equal to the number of frames
written minus the current position.
.Pp
The recording latency is obtained similarly, by subtracting
the number of frames read from the current position.
.Pp
It is strongly discouraged to use the latency and/or the buffer
usage for anything but monitoring.
Especially, note that
.Fn sio_write
might block even if there is buffer space left;
using the buffer usage to guess if
.Fn sio_write
would block is false and leads to unreliable programs \(en consider using
.Xr poll 2
for this.
.Ss Handling buffer overruns and underruns
When the application cannot accept recorded data fast enough,
the record buffer (of size
.Va appbufsz )
might overrun; in this case recorded data is lost.
Similarly if the application cannot provide data to play
fast enough, the play buffer underruns and silence is played
instead.
Depending on the
.Va xrun
parameter of the
.Va sio_par
structure, the audio subsystem will behave as follows:
.Bl -tag -width "SIO_IGNORE"
.It SIO_IGNORE
The stream is paused during overruns and underruns,
thus the current position (obtained through
.Va sio_onmove )
stops being incremented.
Once the overrun and/or underrun condition is gone, the stream is unpaused;
play and record are always kept in sync.
With this mode, the application cannot notice
underruns and/or overruns and shouldn't care about them.
.Pp
This mode is the default.
It's suitable for applications,
like audio players and telephony, where time
is not important and overruns or underruns are not short.
.It SIO_SYNC
If the play buffer underruns, then silence is played,
but in order to reach the right position in time,
the same amount of written samples will be
discarded once the application is unblocked.
Similarly, if the record buffer overruns, then
samples are discarded, but the same amount of silence will be
returned later.
The current position (obtained through
.Va sio_onmove )
is still incremented.
When the play buffer underruns the play latency might become negative;
when the record buffer overruns, the record latency might become
larger than
.Va bufsz .
.Pp
This mode is suitable for applications, like music production,
where time is important and where underruns or overruns are
short and rare.
.It SIO_ERROR
With this mode, on the first play buffer underrun or
record buffer overrun, the stream is terminated and
no other function than
.Fn sio_close
will succeed.
.Pp
This mode is mostly useful for testing; portable
applications shouldn't depend on it, since it's not available
on other systems.
.El
.Ss Controlling the volume
The
.Fn sio_setvol
function can be used to set playback attenuation.
The
.Va vol
parameter takes a value between 0 (maximum attenuation)
and
.Dv SIO_MAXVOL
(no attenuation).
It specifies the weight the audio subsystem will
give to this stream.
It is not meant to control hardware parameters like
speaker gain; the
.Xr mixerctl 1
interface should be used for that purpose instead.
.Pp
An application can use the
.Fn sio_onvol
function to register a callback function that
will be called each time the volume is changed,
including when
.Fn sio_setvol
is used.
The callback is always invoked when
.Fn sio_onvol
is called in order to provide the initial volume.
An application can safely assume that once
.Fn sio_onvol
has returned a non-zero value,
the callback has been invoked and thus
the current volume is available.
If there's no volume setting available,
.Fn sio_onvol
returns 0 and the callback is never invoked and calls to
.Fn sio_setvol
are ignored.
.Pp
The
.Fn sio_onvol
function can be called with a NULL argument to check whether
a volume knob is available.
.Ss Error handling
Errors related to the audio subsystem
(like hardware errors, dropped connections) and
programming errors (e.g. call to
.Fn sio_read
on a play-only stream) are considered fatal.
Once an error occurs, all functions taking a
.Va sio_hdl
argument, except
.Fn sio_close
and
.Fn sio_eof ,
stop working (i.e. always return 0).
.Pp
The
.Fn sio_eof
function can be used at any stage;
it returns 0 if there's no pending error, and a non-zero
value if there's an error.
.Sh RETURN VALUES
The
.Fn sio_open
function returns the newly created handle on success or NULL
on failure.
The
.Fn sio_setpar ,
.Fn sio_getpar ,
.Fn sio_getcap ,
.Fn sio_start ,
.Fn sio_stop ,
.Fn sio_pollfd
and
.Fn sio_setvol
functions return 1 on success and 0 on failure.
The
.Fn sio_read
and
.Fn sio_write
functions return the number of bytes transferred.
.Sh ENVIRONMENT
.Bl -tag -width "SNDIO_DEBUGXXX" -compact
.It Ev AUDIODEVICE
Device to use if
.Fn sio_open
is called with a NULL
.Va name
argument.
.It Ev SNDIO_DEBUG
The debug level:
may be a value between 0 and 2.
.El
.Sh FILES
.Bl -tag -width "/tmp/aucat-<uid>/aucat0" -compact
.It Pa /tmp/aucat-<uid>/aucat0
Default path to
.Xr sndiod 1
socket to connect to.
.It Pa /dev/audio
Default
.Xr audio 4
device to use.
.El
.\".Sh EXAMPLES
.\".Bd -literal -offset indent
.\".Ed
.Sh SEE ALSO
.Xr sndiod 1 ,
.Xr audio 4 ,
.Xr sndio 7 ,
.Xr audio 9
.Sh BUGS
The
.Xr audio 4
driver cannot drain playback buffers in the background, thus if
.Nm libsndio
is used to directly access an
.Xr audio 4
device,
the
.Fn sio_stop
function will stop playback immediately.
.Pp
The
.Xr sndiod 1
server doesn't implement flow control (for performance reasons).
If the application doesn't consume recorded data fast enough then
.Dq "control messages"
are delayed and consequently
.Va sio_onmove
callback or volume changes may be delayed.
.Pp
The
.Fn sio_open ,
.Fn sio_setpar ,
.Fn sio_getpar ,
.Fn sio_getcap ,
.Fn sio_start
and
.Fn sio_stop
functions may block for a very short period of time, thus they should
be avoided in code sections where blocking is not desirable.
|