clarify sio_stop() and friends

This commit is contained in:
Alexandre Ratchov 2013-12-27 13:20:04 +01:00
parent f4f0b9e7b7
commit a49e6f5991
1 changed files with 19 additions and 24 deletions

View File

@ -82,11 +82,6 @@ library allows user processes to access
hardware and the hardware and the
.Xr sndiod 1 .Xr sndiod 1
audio server in a uniform way. 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 device .Ss Opening and closing an audio device
First the application must call the First the application must call the
.Fn sio_open .Fn sio_open
@ -127,10 +122,12 @@ functions (see below) will be non-blocking.
.Pp .Pp
The The
.Fn sio_close .Fn sio_close
function closes the device and frees the handle. function stops the device as if
If the device is not stopped it will be stopped first as if
.Fn sio_stop .Fn sio_stop
is called. is called and frees the handle.
Thus, no samples submitted with
.Fn sio_write
are discarded.
.Ss Negotiating audio parameters .Ss Negotiating audio parameters
Audio samples are interleaved. Audio samples are interleaved.
A frame consists of one sample for each channel. A frame consists of one sample for each channel.
@ -234,11 +231,12 @@ structure using
.Fn sio_initpar .Fn sio_initpar
and fill it with and fill it with
the desired parameters. the desired parameters.
If the application supports any value for a given parameter,
then the corresponding parameter should be left unset.
Then call Then call
.Fn sio_setpar .Fn sio_setpar
to request the device to use them. to request the device to use them.
Parameters left unset in the
.Va sio_par
structure will be set to device-specific defaults.
.It .It
Call Call
.Fn sio_getpar .Fn sio_getpar
@ -255,13 +253,12 @@ has been called,
.Fn sio_stop .Fn sio_stop
must be called before parameters can be changed. must be called before parameters can be changed.
.Pp .Pp
If If the device is exposed by the
.Nm libsndio
is used to connect to the
.Xr sndiod 1 .Xr sndiod 1
server, a transparent emulation layer will server, which is the default configuration,
automatically be set up, and in this case any a transparent emulation layer will
parameters are supported. automatically be set up, and in this case any combination of
rate, encoding and numbers of channels is supported.
.Pp .Pp
To ease filling the To ease filling the
.Va sio_par .Va sio_par
@ -387,17 +384,15 @@ synchronously as soon as enough data to play is available.
.Pp .Pp
The The
.Fn sio_stop .Fn sio_stop
function stops playback and recording and puts the audio subsystem function puts the audio subsystem
in the same state as after in the same state as before
.Fn sio_open .Fn sio_start
is called. is called.
Samples in the play buffers are not discarded, and will continue to It stops recording, drains the play buffer and then stops playback.
be played after
.Fn sio_stop
returns.
If samples to play are queued but playback hasn't started yet If samples to play are queued but playback hasn't started yet
then playback is forced immediately; the device will actually stop then playback is forced immediately; playback will actually stop
once the buffer is drained. once the buffer is drained.
In no case are samples in the play buffer discarded.
.Ss Playing and recording .Ss Playing and recording
When record mode is selected, the When record mode is selected, the
.Fn sio_read .Fn sio_read