Audio Device Objects

The audio device objects are returned by open define the following methods (except control objects which only provide getinfo, setinfo and drain):


\begin{funcdesc}{close}{}
This method explicitly closes the device. It is useful...
...other references to it. A closed device should not be used again.
\end{funcdesc}


\begin{funcdesc}{drain}{}
This method waits until all pending output is processe...
...ically close the audio device and this will do an implicit drain.
\end{funcdesc}


\begin{funcdesc}{flush}{}
This method discards all pending output. It can be use...
...r's stop request (due to buffering of up to one
second of sound).
\end{funcdesc}


\begin{funcdesc}{getinfo}{}
This method retrieves status information like input ...
...e{i_gain}
and \code{monitor_gain} plainly as \code{monitor_gain}.
\end{funcdesc}


\begin{funcdesc}{ibufcount}{}
This method returns the number of samples that are...
... program will not block on a \code{read} call of so many samples.
\end{funcdesc}


\begin{funcdesc}{obufcount}{}
This method returns the number of samples buffered...
...ocking since the kernel
output queue length seems to be variable.
\end{funcdesc}


\begin{funcdesc}{read}{size}
This method reads \var{size} samples from the audio...
...ython string. The function blocks until enough data is available.
\end{funcdesc}


\begin{funcdesc}{setinfo}{status}
This method sets the audio device status param...
... returned by \code{getinfo} and
possibly modified by the program.
\end{funcdesc}


\begin{funcdesc}{write}{samples}
Write is passed a python string containing audi...
...r space free it will immediately return,
otherwise it will block.
\end{funcdesc}

There is a companion module, SUNAUDIODEV, which defines useful symbolic constants like MIN_GAIN, MAX_GAIN, SPEAKER, etc. The names of the constants are the same names as used in the C include file <sun/audioio.h>, with the leading string AUDIO_ stripped.

Useability of the control device is limited at the moment, since there is no way to use the ``wait for something to happen'' feature the device provides.