blob: 1936601badeedea7ae07e5f2af5f34f2dd3c5b9e [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{al} ---
Fred Drakef6863c11999-03-02 16:37:17 +00002 Audio functions on the SGI}
Fred Drakeb91e9341998-07-23 17:59:49 +00003
Fred Drakef6863c11999-03-02 16:37:17 +00004\declaremodule{builtin}{al}
5 \platform{IRIX}
Fred Drakeb91e9341998-07-23 17:59:49 +00006\modulesynopsis{Audio functions on the SGI.}
7
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00008
Guido van Rossum470be141995-03-17 16:07:09 +00009This module provides access to the audio facilities of the SGI Indy
10and Indigo workstations. See section 3A of the IRIX man pages for
11details. You'll need to read those man pages to understand what these
12functions do! Some of the functions are not available in IRIX
13releases before 4.0.5. Again, see the manual to check whether a
14specific function is available on your platform.
15
16All functions and methods defined in this module are equivalent to
Fred Drakef6863c11999-03-02 16:37:17 +000017the C functions with \samp{AL} prefixed to their name.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000018
Fred Drakef6863c11999-03-02 16:37:17 +000019Symbolic constants from the C header file \code{<audio.h>} are
Fred Drakefc576191998-04-04 07:15:02 +000020defined in the standard module \module{AL}\refstmodindex{AL}, see
21below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000022
23\strong{Warning:} the current version of the audio library may dump core
24when bad argument values are passed rather than returning an error
25status. Unfortunately, since the precise circumstances under which
26this may happen are undocumented and hard to check, the Python
27interface can provide no protection against this kind of problems.
28(One example is specifying an excessive queue size --- there is no
29documented upper limit.)
30
Guido van Rossum470be141995-03-17 16:07:09 +000031The module defines the following functions:
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000032
Guido van Rossum470be141995-03-17 16:07:09 +000033
Fred Drakecce10901998-03-17 06:33:25 +000034\begin{funcdesc}{openport}{name, direction\optional{, config}}
Fred Drakefc576191998-04-04 07:15:02 +000035The name and direction arguments are strings. The optional
36\var{config} argument is a configuration object as returned by
37\function{newconfig()}. The return value is an \dfn{audio port
38object}; methods of audio port objects are described below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000039\end{funcdesc}
40
41\begin{funcdesc}{newconfig}{}
Fred Drakefc576191998-04-04 07:15:02 +000042The return value is a new \dfn{audio configuration object}; methods of
43audio configuration objects are described below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000044\end{funcdesc}
45
46\begin{funcdesc}{queryparams}{device}
Guido van Rossum470be141995-03-17 16:07:09 +000047The device argument is an integer. The return value is a list of
Fred Drakefc576191998-04-04 07:15:02 +000048integers containing the data returned by \cfunction{ALqueryparams()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000049\end{funcdesc}
50
Fred Drakecce10901998-03-17 06:33:25 +000051\begin{funcdesc}{getparams}{device, list}
Fred Drakefc576191998-04-04 07:15:02 +000052The \var{device} argument is an integer. The list argument is a list
53such as returned by \function{queryparams()}; it is modified in place
54(!).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000055\end{funcdesc}
56
Fred Drakecce10901998-03-17 06:33:25 +000057\begin{funcdesc}{setparams}{device, list}
Fred Drakefc576191998-04-04 07:15:02 +000058The \var{device} argument is an integer. The \var{list} argument is a
59list such as returned by \function{queryparams()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000060\end{funcdesc}
61
Fred Drakefc576191998-04-04 07:15:02 +000062
Guido van Rossum470be141995-03-17 16:07:09 +000063\subsection{Configuration Objects}
Fred Drakefc576191998-04-04 07:15:02 +000064\label{al-config-objects}
Guido van Rossum470be141995-03-17 16:07:09 +000065
Fred Drakefc576191998-04-04 07:15:02 +000066Configuration objects (returned by \function{newconfig()} have the
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000067following methods:
68
Fred Drakefc576191998-04-04 07:15:02 +000069\begin{methoddesc}[audio configuration]{getqueuesize}{}
Guido van Rossum470be141995-03-17 16:07:09 +000070Return the queue size.
Fred Drakefc576191998-04-04 07:15:02 +000071\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000072
Fred Drakefc576191998-04-04 07:15:02 +000073\begin{methoddesc}[audio configuration]{setqueuesize}{size}
Guido van Rossum470be141995-03-17 16:07:09 +000074Set the queue size.
Fred Drakefc576191998-04-04 07:15:02 +000075\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000076
Fred Drakefc576191998-04-04 07:15:02 +000077\begin{methoddesc}[audio configuration]{getwidth}{}
Guido van Rossum470be141995-03-17 16:07:09 +000078Get the sample width.
Fred Drakefc576191998-04-04 07:15:02 +000079\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000080
Fred Drakefc576191998-04-04 07:15:02 +000081\begin{methoddesc}[audio configuration]{setwidth}{width}
Guido van Rossum470be141995-03-17 16:07:09 +000082Set the sample width.
Fred Drakefc576191998-04-04 07:15:02 +000083\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000084
Fred Drakefc576191998-04-04 07:15:02 +000085\begin{methoddesc}[audio configuration]{getchannels}{}
Guido van Rossum470be141995-03-17 16:07:09 +000086Get the channel count.
Fred Drakefc576191998-04-04 07:15:02 +000087\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000088
Fred Drakefc576191998-04-04 07:15:02 +000089\begin{methoddesc}[audio configuration]{setchannels}{nchannels}
Guido van Rossum470be141995-03-17 16:07:09 +000090Set the channel count.
Fred Drakefc576191998-04-04 07:15:02 +000091\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000092
Fred Drakefc576191998-04-04 07:15:02 +000093\begin{methoddesc}[audio configuration]{getsampfmt}{}
Guido van Rossum470be141995-03-17 16:07:09 +000094Get the sample format.
Fred Drakefc576191998-04-04 07:15:02 +000095\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000096
Fred Drakefc576191998-04-04 07:15:02 +000097\begin{methoddesc}[audio configuration]{setsampfmt}{sampfmt}
Guido van Rossum470be141995-03-17 16:07:09 +000098Set the sample format.
Fred Drakefc576191998-04-04 07:15:02 +000099\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000100
Fred Drakefc576191998-04-04 07:15:02 +0000101\begin{methoddesc}[audio configuration]{getfloatmax}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000102Get the maximum value for floating sample formats.
Fred Drakefc576191998-04-04 07:15:02 +0000103\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000104
Fred Drakefc576191998-04-04 07:15:02 +0000105\begin{methoddesc}[audio configuration]{setfloatmax}{floatmax}
Guido van Rossum470be141995-03-17 16:07:09 +0000106Set the maximum value for floating sample formats.
Fred Drakefc576191998-04-04 07:15:02 +0000107\end{methoddesc}
108
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000109
Guido van Rossum470be141995-03-17 16:07:09 +0000110\subsection{Port Objects}
Fred Drakefc576191998-04-04 07:15:02 +0000111\label{al-port-objects}
Guido van Rossum470be141995-03-17 16:07:09 +0000112
Fred Drakefc576191998-04-04 07:15:02 +0000113Port objects, as returned by \function{openport()}, have the following
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000114methods:
115
Fred Drakefc576191998-04-04 07:15:02 +0000116\begin{methoddesc}[audio port]{closeport}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000117Close the port.
Fred Drake34672db1998-04-11 16:24:21 +0000118\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000119
Fred Drakefc576191998-04-04 07:15:02 +0000120\begin{methoddesc}[audio port]{getfd}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000121Return the file descriptor as an int.
Fred Drake34672db1998-04-11 16:24:21 +0000122\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000123
Fred Drakefc576191998-04-04 07:15:02 +0000124\begin{methoddesc}[audio port]{getfilled}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000125Return the number of filled samples.
Fred Drake34672db1998-04-11 16:24:21 +0000126\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000127
Fred Drakefc576191998-04-04 07:15:02 +0000128\begin{methoddesc}[audio port]{getfillable}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000129Return the number of fillable samples.
Fred Drake34672db1998-04-11 16:24:21 +0000130\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000131
Fred Drakefc576191998-04-04 07:15:02 +0000132\begin{methoddesc}[audio port]{readsamps}{nsamples}
Guido van Rossum470be141995-03-17 16:07:09 +0000133Read a number of samples from the queue, blocking if necessary.
134Return the data as a string containing the raw data, (e.g., 2 bytes per
135sample in big-endian byte order (high byte, low byte) if you have set
136the sample width to 2 bytes).
Fred Drake34672db1998-04-11 16:24:21 +0000137\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000138
Fred Drakefc576191998-04-04 07:15:02 +0000139\begin{methoddesc}[audio port]{writesamps}{samples}
Guido van Rossum470be141995-03-17 16:07:09 +0000140Write samples into the queue, blocking if necessary. The samples are
Fred Drakefc576191998-04-04 07:15:02 +0000141encoded as described for the \method{readsamps()} return value.
Fred Drake34672db1998-04-11 16:24:21 +0000142\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000143
Fred Drakefc576191998-04-04 07:15:02 +0000144\begin{methoddesc}[audio port]{getfillpoint}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000145Return the `fill point'.
Fred Drake34672db1998-04-11 16:24:21 +0000146\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000147
Fred Drakefc576191998-04-04 07:15:02 +0000148\begin{methoddesc}[audio port]{setfillpoint}{fillpoint}
Guido van Rossum470be141995-03-17 16:07:09 +0000149Set the `fill point'.
Fred Drake34672db1998-04-11 16:24:21 +0000150\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000151
Fred Drakefc576191998-04-04 07:15:02 +0000152\begin{methoddesc}[audio port]{getconfig}{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000153Return a configuration object containing the current configuration of
Guido van Rossum470be141995-03-17 16:07:09 +0000154the port.
Fred Drake34672db1998-04-11 16:24:21 +0000155\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000156
Fred Drakefc576191998-04-04 07:15:02 +0000157\begin{methoddesc}[audio port]{setconfig}{config}
Guido van Rossum470be141995-03-17 16:07:09 +0000158Set the configuration from the argument, a configuration object.
Fred Drake34672db1998-04-11 16:24:21 +0000159\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000160
Fred Drakefc576191998-04-04 07:15:02 +0000161\begin{methoddesc}[audio port]{getstatus}{list}
Guido van Rossum470be141995-03-17 16:07:09 +0000162Get status information on last error.
Fred Drake34672db1998-04-11 16:24:21 +0000163\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000164
Fred Drakefc576191998-04-04 07:15:02 +0000165
Fred Drake295da241998-08-10 19:42:37 +0000166\section{\module{AL} ---
Fred Drakef6863c11999-03-02 16:37:17 +0000167 Constants used with the \module{al} module}
Fred Drakeb91e9341998-07-23 17:59:49 +0000168
Fred Drakef6863c11999-03-02 16:37:17 +0000169\declaremodule{standard}{AL}
170 \platform{IRIX}
Fred Drakeb91e9341998-07-23 17:59:49 +0000171\modulesynopsis{Constants used with the \module{al} module.}
172
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000173
174This module defines symbolic constants needed to use the built-in
Fred Drakefc576191998-04-04 07:15:02 +0000175module \module{al} (see above); they are equivalent to those defined
Fred Drakef6863c11999-03-02 16:37:17 +0000176in the C header file \code{<audio.h>} except that the name prefix
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000177\samp{AL_} is omitted. Read the module source for a complete list of
178the defined names. Suggested use:
179
Fred Drake19479911998-02-13 06:58:54 +0000180\begin{verbatim}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000181import al
182from AL import *
Fred Drake19479911998-02-13 06:58:54 +0000183\end{verbatim}