blob: e3fdc9123f28e8f18d57e0c8ab2cbfb0254a043d [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 Drakeffbe6871999-04-22 21:23:22 +000020defined in the standard module
21\refmodule[al-constants]{AL}\refstmodindex{AL}, see below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000022
Fred Drake0aa811c2001-10-20 04:24:09 +000023\warning{The current version of the audio library may dump core
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000024when 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
Fred Drake0aa811c2001-10-20 04:24:09 +000029documented upper limit.)}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000030
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
Fred Drake93503ca1999-03-12 16:24:22 +000063\subsection{Configuration Objects \label{al-config-objects}}
Guido van Rossum470be141995-03-17 16:07:09 +000064
Raymond Hettinger708c2a82003-07-14 18:36:47 +000065Configuration objects returned by \function{newconfig()} have the
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000066following methods:
67
Fred Drakefc576191998-04-04 07:15:02 +000068\begin{methoddesc}[audio configuration]{getqueuesize}{}
Guido van Rossum470be141995-03-17 16:07:09 +000069Return the queue size.
Fred Drakefc576191998-04-04 07:15:02 +000070\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000071
Fred Drakefc576191998-04-04 07:15:02 +000072\begin{methoddesc}[audio configuration]{setqueuesize}{size}
Guido van Rossum470be141995-03-17 16:07:09 +000073Set the queue size.
Fred Drakefc576191998-04-04 07:15:02 +000074\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000075
Fred Drakefc576191998-04-04 07:15:02 +000076\begin{methoddesc}[audio configuration]{getwidth}{}
Guido van Rossum470be141995-03-17 16:07:09 +000077Get the sample width.
Fred Drakefc576191998-04-04 07:15:02 +000078\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000079
Fred Drakefc576191998-04-04 07:15:02 +000080\begin{methoddesc}[audio configuration]{setwidth}{width}
Guido van Rossum470be141995-03-17 16:07:09 +000081Set the sample width.
Fred Drakefc576191998-04-04 07:15:02 +000082\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000083
Fred Drakefc576191998-04-04 07:15:02 +000084\begin{methoddesc}[audio configuration]{getchannels}{}
Guido van Rossum470be141995-03-17 16:07:09 +000085Get the channel count.
Fred Drakefc576191998-04-04 07:15:02 +000086\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000087
Fred Drakefc576191998-04-04 07:15:02 +000088\begin{methoddesc}[audio configuration]{setchannels}{nchannels}
Guido van Rossum470be141995-03-17 16:07:09 +000089Set the channel count.
Fred Drakefc576191998-04-04 07:15:02 +000090\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000091
Fred Drakefc576191998-04-04 07:15:02 +000092\begin{methoddesc}[audio configuration]{getsampfmt}{}
Guido van Rossum470be141995-03-17 16:07:09 +000093Get the sample format.
Fred Drakefc576191998-04-04 07:15:02 +000094\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000095
Fred Drakefc576191998-04-04 07:15:02 +000096\begin{methoddesc}[audio configuration]{setsampfmt}{sampfmt}
Guido van Rossum470be141995-03-17 16:07:09 +000097Set the sample format.
Fred Drakefc576191998-04-04 07:15:02 +000098\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000099
Fred Drakefc576191998-04-04 07:15:02 +0000100\begin{methoddesc}[audio configuration]{getfloatmax}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000101Get the maximum value for floating sample formats.
Fred Drakefc576191998-04-04 07:15:02 +0000102\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000103
Fred Drakefc576191998-04-04 07:15:02 +0000104\begin{methoddesc}[audio configuration]{setfloatmax}{floatmax}
Guido van Rossum470be141995-03-17 16:07:09 +0000105Set the maximum value for floating sample formats.
Fred Drakefc576191998-04-04 07:15:02 +0000106\end{methoddesc}
107
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000108
Fred Drake93503ca1999-03-12 16:24:22 +0000109\subsection{Port Objects \label{al-port-objects}}
Guido van Rossum470be141995-03-17 16:07:09 +0000110
Fred Drakefc576191998-04-04 07:15:02 +0000111Port objects, as returned by \function{openport()}, have the following
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000112methods:
113
Fred Drakefc576191998-04-04 07:15:02 +0000114\begin{methoddesc}[audio port]{closeport}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000115Close the port.
Fred Drake34672db1998-04-11 16:24:21 +0000116\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000117
Fred Drakefc576191998-04-04 07:15:02 +0000118\begin{methoddesc}[audio port]{getfd}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000119Return the file descriptor as an int.
Fred Drake34672db1998-04-11 16:24:21 +0000120\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000121
Fred Drakefc576191998-04-04 07:15:02 +0000122\begin{methoddesc}[audio port]{getfilled}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000123Return the number of filled samples.
Fred Drake34672db1998-04-11 16:24:21 +0000124\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000125
Fred Drakefc576191998-04-04 07:15:02 +0000126\begin{methoddesc}[audio port]{getfillable}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000127Return the number of fillable samples.
Fred Drake34672db1998-04-11 16:24:21 +0000128\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000129
Fred Drakefc576191998-04-04 07:15:02 +0000130\begin{methoddesc}[audio port]{readsamps}{nsamples}
Guido van Rossum470be141995-03-17 16:07:09 +0000131Read a number of samples from the queue, blocking if necessary.
132Return the data as a string containing the raw data, (e.g., 2 bytes per
133sample in big-endian byte order (high byte, low byte) if you have set
134the sample width to 2 bytes).
Fred Drake34672db1998-04-11 16:24:21 +0000135\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000136
Fred Drakefc576191998-04-04 07:15:02 +0000137\begin{methoddesc}[audio port]{writesamps}{samples}
Guido van Rossum470be141995-03-17 16:07:09 +0000138Write samples into the queue, blocking if necessary. The samples are
Fred Drakefc576191998-04-04 07:15:02 +0000139encoded as described for the \method{readsamps()} return value.
Fred Drake34672db1998-04-11 16:24:21 +0000140\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000141
Fred Drakefc576191998-04-04 07:15:02 +0000142\begin{methoddesc}[audio port]{getfillpoint}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000143Return the `fill point'.
Fred Drake34672db1998-04-11 16:24:21 +0000144\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000145
Fred Drakefc576191998-04-04 07:15:02 +0000146\begin{methoddesc}[audio port]{setfillpoint}{fillpoint}
Guido van Rossum470be141995-03-17 16:07:09 +0000147Set the `fill point'.
Fred Drake34672db1998-04-11 16:24:21 +0000148\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000149
Fred Drakefc576191998-04-04 07:15:02 +0000150\begin{methoddesc}[audio port]{getconfig}{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000151Return a configuration object containing the current configuration of
Guido van Rossum470be141995-03-17 16:07:09 +0000152the port.
Fred Drake34672db1998-04-11 16:24:21 +0000153\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000154
Fred Drakefc576191998-04-04 07:15:02 +0000155\begin{methoddesc}[audio port]{setconfig}{config}
Guido van Rossum470be141995-03-17 16:07:09 +0000156Set the configuration from the argument, a configuration object.
Fred Drake34672db1998-04-11 16:24:21 +0000157\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000158
Fred Drakefc576191998-04-04 07:15:02 +0000159\begin{methoddesc}[audio port]{getstatus}{list}
Guido van Rossum470be141995-03-17 16:07:09 +0000160Get status information on last error.
Fred Drake34672db1998-04-11 16:24:21 +0000161\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000162
Fred Drakefc576191998-04-04 07:15:02 +0000163
Fred Drake295da241998-08-10 19:42:37 +0000164\section{\module{AL} ---
Fred Drakef6863c11999-03-02 16:37:17 +0000165 Constants used with the \module{al} module}
Fred Drakeb91e9341998-07-23 17:59:49 +0000166
Fred Drake93503ca1999-03-12 16:24:22 +0000167\declaremodule[al-constants]{standard}{AL}
Fred Drakef6863c11999-03-02 16:37:17 +0000168 \platform{IRIX}
Fred Drakeb91e9341998-07-23 17:59:49 +0000169\modulesynopsis{Constants used with the \module{al} module.}
170
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000171
172This module defines symbolic constants needed to use the built-in
Fred Drakeffbe6871999-04-22 21:23:22 +0000173module \refmodule{al} (see above); they are equivalent to those defined
Fred Drakef6863c11999-03-02 16:37:17 +0000174in the C header file \code{<audio.h>} except that the name prefix
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000175\samp{AL_} is omitted. Read the module source for a complete list of
176the defined names. Suggested use:
177
Fred Drake19479911998-02-13 06:58:54 +0000178\begin{verbatim}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000179import al
180from AL import *
Fred Drake19479911998-02-13 06:58:54 +0000181\end{verbatim}