blob: fb31ffaa3ba08333a9e24ca85574056337db1b1c [file] [log] [blame]
Fred Drakefc576191998-04-04 07:15:02 +00001\section{Built-in Module \module{al}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-al}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00003\bimodindex{al}
4
Guido van Rossum470be141995-03-17 16:07:09 +00005This module provides access to the audio facilities of the SGI Indy
6and Indigo workstations. See section 3A of the IRIX man pages for
7details. You'll need to read those man pages to understand what these
8functions do! Some of the functions are not available in IRIX
9releases before 4.0.5. Again, see the manual to check whether a
10specific function is available on your platform.
11
12All functions and methods defined in this module are equivalent to
Fred Drakefc576191998-04-04 07:15:02 +000013the \C{} functions with \samp{AL} prefixed to their name.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000014
Fred Drakefc576191998-04-04 07:15:02 +000015Symbolic constants from the \C{} header file \code{<audio.h>} are
16defined in the standard module \module{AL}\refstmodindex{AL}, see
17below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000018
19\strong{Warning:} the current version of the audio library may dump core
20when bad argument values are passed rather than returning an error
21status. Unfortunately, since the precise circumstances under which
22this may happen are undocumented and hard to check, the Python
23interface can provide no protection against this kind of problems.
24(One example is specifying an excessive queue size --- there is no
25documented upper limit.)
26
Guido van Rossum470be141995-03-17 16:07:09 +000027The module defines the following functions:
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000028
Guido van Rossum470be141995-03-17 16:07:09 +000029
Fred Drakecce10901998-03-17 06:33:25 +000030\begin{funcdesc}{openport}{name, direction\optional{, config}}
Fred Drakefc576191998-04-04 07:15:02 +000031The name and direction arguments are strings. The optional
32\var{config} argument is a configuration object as returned by
33\function{newconfig()}. The return value is an \dfn{audio port
34object}; methods of audio port objects are described below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000035\end{funcdesc}
36
37\begin{funcdesc}{newconfig}{}
Fred Drakefc576191998-04-04 07:15:02 +000038The return value is a new \dfn{audio configuration object}; methods of
39audio configuration objects are described below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000040\end{funcdesc}
41
42\begin{funcdesc}{queryparams}{device}
Guido van Rossum470be141995-03-17 16:07:09 +000043The device argument is an integer. The return value is a list of
Fred Drakefc576191998-04-04 07:15:02 +000044integers containing the data returned by \cfunction{ALqueryparams()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000045\end{funcdesc}
46
Fred Drakecce10901998-03-17 06:33:25 +000047\begin{funcdesc}{getparams}{device, list}
Fred Drakefc576191998-04-04 07:15:02 +000048The \var{device} argument is an integer. The list argument is a list
49such as returned by \function{queryparams()}; it is modified in place
50(!).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000051\end{funcdesc}
52
Fred Drakecce10901998-03-17 06:33:25 +000053\begin{funcdesc}{setparams}{device, list}
Fred Drakefc576191998-04-04 07:15:02 +000054The \var{device} argument is an integer. The \var{list} argument is a
55list such as returned by \function{queryparams()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000056\end{funcdesc}
57
Fred Drakefc576191998-04-04 07:15:02 +000058
Guido van Rossum470be141995-03-17 16:07:09 +000059\subsection{Configuration Objects}
Fred Drakefc576191998-04-04 07:15:02 +000060\label{al-config-objects}
Guido van Rossum470be141995-03-17 16:07:09 +000061
Fred Drakefc576191998-04-04 07:15:02 +000062Configuration objects (returned by \function{newconfig()} have the
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000063following methods:
64
Fred Drakefc576191998-04-04 07:15:02 +000065\begin{methoddesc}[audio configuration]{getqueuesize}{}
Guido van Rossum470be141995-03-17 16:07:09 +000066Return the queue size.
Fred Drakefc576191998-04-04 07:15:02 +000067\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000068
Fred Drakefc576191998-04-04 07:15:02 +000069\begin{methoddesc}[audio configuration]{setqueuesize}{size}
Guido van Rossum470be141995-03-17 16:07:09 +000070Set 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]{getwidth}{}
Guido van Rossum470be141995-03-17 16:07:09 +000074Get the sample width.
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]{setwidth}{width}
Guido van Rossum470be141995-03-17 16:07:09 +000078Set 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]{getchannels}{}
Guido van Rossum470be141995-03-17 16:07:09 +000082Get the channel count.
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]{setchannels}{nchannels}
Guido van Rossum470be141995-03-17 16:07:09 +000086Set 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]{getsampfmt}{}
Guido van Rossum470be141995-03-17 16:07:09 +000090Get the sample format.
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]{setsampfmt}{sampfmt}
Guido van Rossum470be141995-03-17 16:07:09 +000094Set 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]{getfloatmax}{}
Guido van Rossum470be141995-03-17 16:07:09 +000098Get the maximum value for floating sample formats.
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]{setfloatmax}{floatmax}
Guido van Rossum470be141995-03-17 16:07:09 +0000102Set the maximum value for floating sample formats.
Fred Drakefc576191998-04-04 07:15:02 +0000103\end{methoddesc}
104
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000105
Guido van Rossum470be141995-03-17 16:07:09 +0000106\subsection{Port Objects}
Fred Drakefc576191998-04-04 07:15:02 +0000107\label{al-port-objects}
Guido van Rossum470be141995-03-17 16:07:09 +0000108
Fred Drakefc576191998-04-04 07:15:02 +0000109Port objects, as returned by \function{openport()}, have the following
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000110methods:
111
Fred Drakefc576191998-04-04 07:15:02 +0000112\begin{methoddesc}[audio port]{closeport}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000113Close the port.
Fred Drakefc576191998-04-04 07:15:02 +0000114\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000115
Fred Drakefc576191998-04-04 07:15:02 +0000116\begin{methoddesc}[audio port]{getfd}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000117Return the file descriptor as an int.
Fred Drakefc576191998-04-04 07:15:02 +0000118\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000119
Fred Drakefc576191998-04-04 07:15:02 +0000120\begin{methoddesc}[audio port]{getfilled}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000121Return the number of filled samples.
Fred Drakefc576191998-04-04 07:15:02 +0000122\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000123
Fred Drakefc576191998-04-04 07:15:02 +0000124\begin{methoddesc}[audio port]{getfillable}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000125Return the number of fillable samples.
Fred Drakefc576191998-04-04 07:15:02 +0000126\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000127
Fred Drakefc576191998-04-04 07:15:02 +0000128\begin{methoddesc}[audio port]{readsamps}{nsamples}
Guido van Rossum470be141995-03-17 16:07:09 +0000129Read a number of samples from the queue, blocking if necessary.
130Return the data as a string containing the raw data, (e.g., 2 bytes per
131sample in big-endian byte order (high byte, low byte) if you have set
132the sample width to 2 bytes).
Fred Drakefc576191998-04-04 07:15:02 +0000133\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000134
Fred Drakefc576191998-04-04 07:15:02 +0000135\begin{methoddesc}[audio port]{writesamps}{samples}
Guido van Rossum470be141995-03-17 16:07:09 +0000136Write samples into the queue, blocking if necessary. The samples are
Fred Drakefc576191998-04-04 07:15:02 +0000137encoded as described for the \method{readsamps()} return value.
138\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000139
Fred Drakefc576191998-04-04 07:15:02 +0000140\begin{methoddesc}[audio port]{getfillpoint}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000141Return the `fill point'.
Fred Drakefc576191998-04-04 07:15:02 +0000142\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000143
Fred Drakefc576191998-04-04 07:15:02 +0000144\begin{methoddesc}[audio port]{setfillpoint}{fillpoint}
Guido van Rossum470be141995-03-17 16:07:09 +0000145Set the `fill point'.
Fred Drakefc576191998-04-04 07:15:02 +0000146\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000147
Fred Drakefc576191998-04-04 07:15:02 +0000148\begin{methoddesc}[audio port]{getconfig}{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000149Return a configuration object containing the current configuration of
Guido van Rossum470be141995-03-17 16:07:09 +0000150the port.
Fred Drakefc576191998-04-04 07:15:02 +0000151\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000152
Fred Drakefc576191998-04-04 07:15:02 +0000153\begin{methoddesc}[audio port]{setconfig}{config}
Guido van Rossum470be141995-03-17 16:07:09 +0000154Set the configuration from the argument, a configuration object.
Fred Drakefc576191998-04-04 07:15:02 +0000155\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000156
Fred Drakefc576191998-04-04 07:15:02 +0000157\begin{methoddesc}[audio port]{getstatus}{list}
Guido van Rossum470be141995-03-17 16:07:09 +0000158Get status information on last error.
Fred Drakefc576191998-04-04 07:15:02 +0000159\end{methoddesc}[audio port]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000160
Fred Drakefc576191998-04-04 07:15:02 +0000161
162\section{Standard Module \module{AL}}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000163\nodename{AL (uppercase)}
164\stmodindex{AL}
165
166This module defines symbolic constants needed to use the built-in
Fred Drakefc576191998-04-04 07:15:02 +0000167module \module{al} (see above); they are equivalent to those defined
168in the \C{} header file \code{<audio.h>} except that the name prefix
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000169\samp{AL_} is omitted. Read the module source for a complete list of
170the defined names. Suggested use:
171
Fred Drake19479911998-02-13 06:58:54 +0000172\begin{verbatim}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000173import al
174from AL import *
Fred Drake19479911998-02-13 06:58:54 +0000175\end{verbatim}