| 1 | \section{\module{sunaudiodev} ---
|
|---|
| 2 | Access to Sun audio hardware}
|
|---|
| 3 |
|
|---|
| 4 | \declaremodule{builtin}{sunaudiodev}
|
|---|
| 5 | \platform{SunOS}
|
|---|
| 6 | \modulesynopsis{Access to Sun audio hardware.}
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 | This module allows you to access the Sun audio interface. The Sun
|
|---|
| 10 | audio hardware is capable of recording and playing back audio data
|
|---|
| 11 | in u-LAW\index{u-LAW} format with a sample rate of 8K per second. A
|
|---|
| 12 | full description can be found in the \manpage{audio}{7I} manual page.
|
|---|
| 13 |
|
|---|
| 14 | The module
|
|---|
| 15 | \refmodule[sunaudiodev-constants]{SUNAUDIODEV}\refstmodindex{SUNAUDIODEV}
|
|---|
| 16 | defines constants which may be used with this module.
|
|---|
| 17 |
|
|---|
| 18 | This module defines the following variables and functions:
|
|---|
| 19 |
|
|---|
| 20 | \begin{excdesc}{error}
|
|---|
| 21 | This exception is raised on all errors. The argument is a string
|
|---|
| 22 | describing what went wrong.
|
|---|
| 23 | \end{excdesc}
|
|---|
| 24 |
|
|---|
| 25 | \begin{funcdesc}{open}{mode}
|
|---|
| 26 | This function opens the audio device and returns a Sun audio device
|
|---|
| 27 | object. This object can then be used to do I/O on. The \var{mode} parameter
|
|---|
| 28 | is one of \code{'r'} for record-only access, \code{'w'} for play-only
|
|---|
| 29 | access, \code{'rw'} for both and \code{'control'} for access to the
|
|---|
| 30 | control device. Since only one process is allowed to have the recorder
|
|---|
| 31 | or player open at the same time it is a good idea to open the device
|
|---|
| 32 | only for the activity needed. See \manpage{audio}{7I} for details.
|
|---|
| 33 |
|
|---|
| 34 | As per the manpage, this module first looks in the environment
|
|---|
| 35 | variable \code{AUDIODEV} for the base audio device filename. If not
|
|---|
| 36 | found, it falls back to \file{/dev/audio}. The control device is
|
|---|
| 37 | calculated by appending ``ctl'' to the base audio device.
|
|---|
| 38 | \end{funcdesc}
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | \subsection{Audio Device Objects \label{audio-device-objects}}
|
|---|
| 42 |
|
|---|
| 43 | The audio device objects are returned by \function{open()} define the
|
|---|
| 44 | following methods (except \code{control} objects which only provide
|
|---|
| 45 | \method{getinfo()}, \method{setinfo()}, \method{fileno()}, and
|
|---|
| 46 | \method{drain()}):
|
|---|
| 47 |
|
|---|
| 48 | \begin{methoddesc}[audio device]{close}{}
|
|---|
| 49 | This method explicitly closes the device. It is useful in situations
|
|---|
| 50 | where deleting the object does not immediately close it since there
|
|---|
| 51 | are other references to it. A closed device should not be used again.
|
|---|
| 52 | \end{methoddesc}
|
|---|
| 53 |
|
|---|
| 54 | \begin{methoddesc}[audio device]{fileno}{}
|
|---|
| 55 | Returns the file descriptor associated with the device. This can be
|
|---|
| 56 | used to set up \code{SIGPOLL} notification, as described below.
|
|---|
| 57 | \end{methoddesc}
|
|---|
| 58 |
|
|---|
| 59 | \begin{methoddesc}[audio device]{drain}{}
|
|---|
| 60 | This method waits until all pending output is processed and then returns.
|
|---|
| 61 | Calling this method is often not necessary: destroying the object will
|
|---|
| 62 | automatically close the audio device and this will do an implicit drain.
|
|---|
| 63 | \end{methoddesc}
|
|---|
| 64 |
|
|---|
| 65 | \begin{methoddesc}[audio device]{flush}{}
|
|---|
| 66 | This method discards all pending output. It can be used avoid the
|
|---|
| 67 | slow response to a user's stop request (due to buffering of up to one
|
|---|
| 68 | second of sound).
|
|---|
|
|---|