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