blob: e1b1e6f49d06901eaf4cbbe15e6fe57167fe49f7 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{al} ---
2 Audio functions on the SGI.}
Fred Drakeb91e9341998-07-23 17:59:49 +00003\declaremodule{builtin}{al}
4
5\modulesynopsis{Audio functions on the SGI.}
6
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00007
Guido van Rossum470be141995-03-17 16:07:09 +00008This module provides access to the audio facilities of the SGI Indy
9and Indigo workstations. See section 3A of the IRIX man pages for
10details. You'll need to read those man pages to understand what these
11functions do! Some of the functions are not available in IRIX
12releases before 4.0.5. Again, see the manual to check whether a
13specific function is available on your platform.
14
15All functions and methods defined in this module are equivalent to
Fred Drakefc576191998-04-04 07:15:02 +000016the \C{} functions with \samp{AL} prefixed to their name.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000017
Fred Drakefc576191998-04-04 07:15:02 +000018Symbolic constants from the \C{} header file \code{<audio.h>} are
19defined in the standard module \module{AL}\refstmodindex{AL}, see
20below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000021
22\strong{Warning:} the current version of the audio library may dump core
23when bad argument values are passed rather than returning an error
24status. Unfortunately, since the precise circumstances under which
25this may happen are undocumented and hard to check, the Python
26interface can provide no protection against this kind of problems.
27(One example is specifying an excessive queue size --- there is no
28documented upper limit.)
29
Guido van Rossum470be141995-03-17 16:07:09 +000030The module defines the following functions:
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000031
Guido van Rossum470be141995-03-17 16:07:09 +000032
Fred Drakecce10901998-03-17 06:33:25 +000033\begin{funcdesc}{openport}{name, direction\optional{, config}}
Fred Drakefc576191998-04-04 07:15:02 +000034The name and direction arguments are strings. The optional
35\var{config} argument is a configuration object as returned by
36\function{newconfig()}. The return value is an \dfn{audio port
37object}; methods of audio port objects are described below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000038\end{funcdesc}
39
40\begin{funcdesc}{newconfig}{}
Fred Drakefc576191998-04-04 07:15:02 +000041The return value is a new \dfn{audio configuration object}; methods of
42audio configuration objects are described below.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000043\end{funcdesc}
44
45\begin{funcdesc}{queryparams}{device}
Guido van Rossum470be141995-03-17 16:07:09 +000046The device argument is an integer. The return value is a list of
Fred Drakefc576191998-04-04 07:15:02 +000047integers containing the data returned by \cfunction{ALqueryparams()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000048\end{funcdesc}
49
Fred Drakecce10901998-03-17 06:33:25 +000050\begin{funcdesc}{getparams}{device, list}
Fred Drakefc576191998-04-04 07:15:02 +000051The \var{device} argument is an integer. The list argument is a list
52such as returned by \function{queryparams()}; it is modified in place
53(!).
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000054\end{funcdesc}
55
Fred Drakecce10901998-03-17 06:33:25 +000056\begin{funcdesc}{setparams}{device, list}
Fred Drakefc576191998-04-04 07:15:02 +000057The \var{device} argument is an integer. The \var{list} argument is a
58list such as returned by \function{queryparams()}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000059\end{funcdesc}
60
Fred Drakefc576191998-04-04 07:15:02 +000061
Guido van Rossum470be141995-03-17 16:07:09 +000062\subsection{Configuration Objects}
Fred Drakefc576191998-04-04 07:15:02 +000063\label{al-config-objects}
Guido van Rossum470be141995-03-17 16:07:09 +000064
Fred Drakefc576191998-04-04 07:15:02 +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
Guido van Rossum470be141995-03-17 16:07:09 +0000109\subsection{Port Objects}
Fred Drakefc576191998-04-04 07:15:02 +0000110\label{al-port-objects}
Guido van Rossum470be141995-03-17 16:07:09 +0000111
Fred Drakefc576191998-04-04 07:15:02 +0000112Port objects, as returned by \function{openport()}, have the following
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000113methods:
114
Fred Drakefc576191998-04-04 07:15:02 +0000115\begin{methoddesc}[audio port]{closeport}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000116Close the port.
Fred Drake34672db1998-04-11 16:24:21 +0000117\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000118
Fred Drakefc576191998-04-04 07:15:02 +0000119\begin{methoddesc}[audio port]{getfd}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000120Return the file descriptor as an int.
Fred Drake34672db1998-04-11 16:24:21 +0000121\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000122
Fred Drakefc576191998-04-04 07:15:02 +0000123\begin{methoddesc}[audio port]{getfilled}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000124Return the number of filled samples.
Fred Drake34672db1998-04-11 16:24:21 +0000125\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000126
Fred Drakefc576191998-04-04 07:15:02 +0000127\begin{methoddesc}[audio port]{getfillable}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000128Return the number of fillable samples.
Fred Drake34672db1998-04-11 16:24:21 +0000129\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000130
Fred Drakefc576191998-04-04 07:15:02 +0000131\begin{methoddesc}[audio port]{readsamps}{nsamples}
Guido van Rossum470be141995-03-17 16:07:09 +0000132Read a number of samples from the queue, blocking if necessary.
133Return the data as a string containing the raw data, (e.g., 2 bytes per
134sample in big-endian byte order (high byte, low byte) if you have set
135the sample width to 2 bytes).
Fred Drake34672db1998-04-11 16:24:21 +0000136\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000137
Fred Drakefc576191998-04-04 07:15:02 +0000138\begin{methoddesc}[audio port]{writesamps}{samples}
Guido van Rossum470be141995-03-17 16:07:09 +0000139Write samples into the queue, blocking if necessary. The samples are
Fred Drakefc576191998-04-04 07:15:02 +0000140encoded as described for the \method{readsamps()} return value.
Fred Drake34672db1998-04-11 16:24:21 +0000141\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000142
Fred Drakefc576191998-04-04 07:15:02 +0000143\begin{methoddesc}[audio port]{getfillpoint}{}
Guido van Rossum470be141995-03-17 16:07:09 +0000144Return the `fill point'.
Fred Drake34672db1998-04-11 16:24:21 +0000145\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000146
Fred Drakefc576191998-04-04 07:15:02 +0000147\begin{methoddesc}[audio port]{setfillpoint}{fillpoint}
Guido van Rossum470be141995-03-17 16:07:09 +0000148Set the `fill point'.
Fred Drake34672db1998-04-11 16:24:21 +0000149\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000150
Fred Drakefc576191998-04-04 07:15:02 +0000151\begin{methoddesc}[audio port]{getconfig}{}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000152Return a configuration object containing the current configuration of
Guido van Rossum470be141995-03-17 16:07:09 +0000153the port.
Fred Drake34672db1998-04-11 16:24:21 +0000154\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000155
Fred Drakefc576191998-04-04 07:15:02 +0000156\begin{methoddesc}[audio port]{setconfig}{config}
Guido van Rossum470be141995-03-17 16:07:09 +0000157Set the configuration from the argument, a configuration object.
Fred Drake34672db1998-04-11 16:24:21 +0000158\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000159
Fred Drakefc576191998-04-04 07:15:02 +0000160\begin{methoddesc}[audio port]{getstatus}{list}
Guido van Rossum470be141995-03-17 16:07:09 +0000161Get status information on last error.
Fred Drake34672db1998-04-11 16:24:21 +0000162\end{methoddesc}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +0000163
Fred Drakefc576191998-04-04 07:15:02 +0000164
Fred Drake295da241998-08-10 19:42:37 +0000165\section{\module{AL} ---
166 Constants used with the \module{al} module.}
Fred Drakeb91e9341998-07-23 17:59:49 +0000167\declaremodule{standard}{AL}
168
169\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 Drakefc576191998-04-04 07:15:02 +0000173module \module{al} (see above); they are equivalent to those defined
174in 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}