blob: 8b9a8f8f88b45aed8204290a549756a51410aedf [file] [log] [blame]
Fred Drakefc576191998-04-04 07:15:02 +00001\section{Built-in Module \module{al}}
Fred Drakeb91e9341998-07-23 17:59:49 +00002\declaremodule{builtin}{al}
3
4\modulesynopsis{Audio functions on the SGI.}
5
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00006
Guido van Rossum470be141995-03-17 16:07:09 +00007This module provides access to the audio facilities of the SGI Indy
8and Indigo workstations. See section 3A of the IRIX man pages for
9details. You'll need to read those man pages to understand what these
10functions do! Some of the functions are not available in IRIX
11releases before 4.0.5. Again, see the manual to check whether a
12specific function is available on your platform.
13
14All functions and methods defined in this module are equivalent to
Fred Drakefc576191998-04-04 07:15:02 +000015the \C{} functions with \samp{AL} prefixed to their name.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000016
Fred Drakefc576191998-04-04 07:15:02 +000017Symbolic constants from the \C{} header file \code{<audio.h>} are
18defined in the standard module \module{AL}\refstmodindex{AL}, see
19below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000020
21\strong{Warning:} the current version of the audio library may dump core
22when bad argument values are passed rather than returning an error
23status. Unfortunately, since the precise circumstances under which
24this may happen are undocumented and hard to check, the Python
25interface can provide no protection against this kind of problems.
26(One example is specifying an excessive queue size --- there is no
27documented upper limit.)
28
Guido van Rossum470be141995-03-17 16:07:09 +000029The module defines the following functions:
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000030
Guido van Rossum470be141995-03-17 16:07:09 +000031
Fred Drakecce10901998-03-17 06:33:25 +000032\begin{funcdesc}{openport}{name, direction\optional{, config}}
Fred Drakefc576191998-04-04 07:15:02 +000033The name and direction arguments are strings. The optional
34\var{config} argument is a configuration object as returned by
35\function{newconfig()}. The return value is an \dfn{audio port
36object}; methods of audio port objects are described below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000037\end{funcdesc}
38
39\begin{funcdesc}{newconfig}{}
Fred Drakefc576191998-04-04 07:15:02 +000040The return value is a new \dfn{audio configuration object}; methods of
41audio configuration objects are described below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000042\end{funcdesc}
43
44\begin{funcdesc}{queryparams}{device}
Guido van Rossum470be141995-03-17 16:07:09 +000045The device argument is an integer. The return value is a list of
Fred Drakefc576191998-04-04 07:15:02 +000046integers containing the data returned by \cfunction{ALqueryparams()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000047\end{funcdesc}
48
Fred Drakecce10901998-03-17 06:33:25 +000049\begin{funcdesc}{getparams}{device, list}
Fred Drakefc576191998-04-04 07:15:02 +000050The \var{device} argument is an integer. The list argument is a list
51such as returned by \function{queryparams()}; it is modified in place
52(!).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000053\end{funcdesc}
54
Fred Drakecce10901998-03-17 06:33:25 +000055\begin{funcdesc}{setparams}{device, list}
Fred Drakefc576191998-04-04 07:15:02 +000056The \var{device} argument is an integer. The \var{list} argument is a
57list such as returned by \function{queryparams()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000058\end{funcdesc}
59
Fred Drakefc576191998-04-04 07:15:02 +000060
Guido van Rossum470be141995-03-17 16:07:09 +000061\subsection{Configuration Objects}
Fred Drakefc576191998-04-04 07:15:02 +000062\label{al-config-objects}
Guido van Rossum470be141995-03-17 16:07:09 +000063
Fred Drakefc576191998-04-04 07:15:02 +000064Configuration objects (returned by \function{newconfig()} have the
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000065following methods:
66
Fred Drakefc576191998-04-04 07:15:02 +000067\begin{methoddesc}[audio configuration]{getqueuesize}{}
Guido van Rossum470be141995-03-17 16:07:09 +000068Return the queue size.
Fred Drakefc576191998-04-04 07:15:02 +000069\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000070
Fred Drakefc576191998-04-04 07:15:02 +000071\begin{methoddesc}[audio configuration]{setqueuesize}{size}
Guido van Rossum470be141995-03-17 16:07:09 +000072Set the queue size.
Fred Drakefc576191998-04-04 07:15:02 +000073\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000074
Fred Drakefc576191998-04-04 07:15:02 +000075\begin{methoddesc}[audio configuration]{getwidth}{}
Guido van Rossum470be141995-03-17 16:07:09 +000076Get the sample width.
Fred Drakefc576191998-04-04 07:15:02 +000077\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000078
Fred Drakefc576191998-04-04 07:15:02 +000079\begin{methoddesc}[audio configuration]{setwidth}{width}
Guido van Rossum470be141995-03-17 16:07:09 +000080Set the sample width.
Fred Drakefc576191998-04-04 07:15:02 +000081\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000082
Fred Drakefc576191998-04-04 07:15:02 +000083\begin{methoddesc}[audio configuration]{getchannels}{}
Guido van Rossum470be141995-03-17 16:07:09 +000084Get the channel count.
Fred Drakefc576191998-04-04 07:15:02 +000085\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000086
Fred Drakefc576191998-04-04 07:15:02 +000087\begin{methoddesc}[audio configuration]{setchannels}{nchannels}
Guido van Rossum470be141995-03-17 16:07:09 +000088Set the channel count.
Fred Drakefc576191998-04-04 07:15:02 +000089\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000090
Fred Drakefc576191998-04-04 07:15:02 +000091\begin{methoddesc}[audio configuration]{getsampfmt}{}
Guido van Rossum470be141995-03-17 16:07:09 +000092Get the sample format.
Fred Drakefc576191998-04-04 07:15:02 +000093\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000094
Fred Drakefc576191998-04-04 07:15:02 +000095\begin{methoddesc}[audio configuration]{setsampfmt}{sampfmt}
Guido van Rossum470be141995-03-17 16:07:09 +000096Set the sample format.
Fred Drakefc576191998-04-04 07:15:02 +000097\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000098
Fred Drakefc576191998-04-04 07:15:02 +000099\begin{methoddesc}[audio configuration]{getfloatmax}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000100Get the maximum value for floating sample formats.
Fred Drakefc576191998-04-04 07:15:02 +0000101\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000102
Fred Drakefc576191998-04-04 07:15:02 +0000103\begin{methoddesc}[audio configuration]{setfloatmax}{floatmax}
Guido van Rossum470be141995-03-17 16:07:09 +0000104Set the maximum value for floating sample formats.
Fred Drakefc576191998-04-04 07:15:02 +0000105\end{methoddesc}
106
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000107
Guido van Rossum470be141995-03-17 16:07:09 +0000108\subsection{Port Objects}
Fred Drakefc576191998-04-04 07:15:02 +0000109\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
164\section{Standard Module \module{AL}}
Fred Drakeb91e9341998-07-23 17:59:49 +0000165\declaremodule{standard}{AL}
166
167\modulesynopsis{Constants used with the \module{al} module.}
168
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000169
170This module defines symbolic constants needed to use the built-in
Fred Drakefc576191998-04-04 07:15:02 +0000171module \module{al} (see above); they are equivalent to those defined
172in the \C{} header file \code{<audio.h>} except that the name prefix
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000173\samp{AL_} is omitted. Read the module source for a complete list of
174the defined names. Suggested use:
175
Fred Drake19479911998-02-13 06:58:54 +0000176\begin{verbatim}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000177import al
178from AL import *
Fred Drake19479911998-02-13 06:58:54 +0000179\end{verbatim}