blob: 51a031246edb8fd2b14a00e690b21c9839aeb2ca [file] [log] [blame]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001\section{Built-in Module \sectcode{al}}
2\bimodindex{al}
3
4This module provides access to the audio facilities of the Indigo and
54D/35 workstations, described in section 3A of the IRIX 4.0 man pages
6(and also available as an option in IRIX 3.3). You'll need to read
7those man pages to understand what these functions do!
8Some of the functions are not available in releases below 4.0.5.
9Again, see the manual to check whether a specific function is
10available on your platform.
11
12Symbolic constants from the C header file \file{<audio.h>} are defined
13in the standard module \code{AL}, see below.
14
15\strong{Warning:} the current version of the audio library may dump core
16when bad argument values are passed rather than returning an error
17status. Unfortunately, since the precise circumstances under which
18this may happen are undocumented and hard to check, the Python
19interface can provide no protection against this kind of problems.
20(One example is specifying an excessive queue size --- there is no
21documented upper limit.)
22
23Module \code{al} defines the following functions:
24
25\renewcommand{\indexsubitem}{(in module al)}
Guido van Rossum16d6e711994-08-08 12:30:22 +000026\begin{funcdesc}{openport}{name\, direction\optional{\, config}}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000027Equivalent to the C function ALopenport(). The name and direction
28arguments are strings. The optional config argument is an opaque
29configuration object as returned by \code{al.newconfig()}. The return
30value is an opaque port object; methods of port objects are described
31below.
32\end{funcdesc}
33
34\begin{funcdesc}{newconfig}{}
35Equivalent to the C function ALnewconfig(). The return value is a new
36opaque configuration object; methods of configuration objects are
37described below.
38\end{funcdesc}
39
40\begin{funcdesc}{queryparams}{device}
41Equivalent to the C function ALqueryparams(). The device argument is
42an integer. The return value is a list of integers containing the
43data returned by ALqueryparams().
44\end{funcdesc}
45
46\begin{funcdesc}{getparams}{device\, list}
47Equivalent to the C function ALgetparams(). The device argument is an
48integer. The list argument is a list such as returned by
49\code{queryparams}; it is modified in place (!).
50\end{funcdesc}
51
52\begin{funcdesc}{setparams}{device\, list}
53Equivalent to the C function ALsetparams(). The device argument is an
54integer.The list argument is a list such as returned by
55\code{al.queryparams}.
56\end{funcdesc}
57
58Configuration objects (returned by \code{al.newconfig()} have the
59following methods:
60
61\renewcommand{\indexsubitem}{(audio configuration object method)}
62\begin{funcdesc}{getqueuesize}{}
63Return the queue size; equivalent to the C function ALgetqueuesize().
64\end{funcdesc}
65
66\begin{funcdesc}{setqueuesize}{size}
67Set the queue size; equivalent to the C function ALsetqueuesize().
68\end{funcdesc}
69
70\begin{funcdesc}{getwidth}{}
71Get the sample width; equivalent to the C function ALgetwidth().
72\end{funcdesc}
73
74\begin{funcdesc}{getwidth}{width}
75Set the sample width; equivalent to the C function ALsetwidth().
76\end{funcdesc}
77
78\begin{funcdesc}{getchannels}{}
79Get the channel count; equivalent to the C function ALgetchannels().
80\end{funcdesc}
81
82\begin{funcdesc}{setchannels}{nchannels}
83Set the channel count; equivalent to the C function ALsetchannels().
84\end{funcdesc}
85
86\begin{funcdesc}{getsampfmt}{}
87Get the sample format; equivalent to the C function ALgetsampfmt().
88\end{funcdesc}
89
90\begin{funcdesc}{setsampfmt}{sampfmt}
91Set the sample format; equivalent to the C function ALsetsampfmt().
92\end{funcdesc}
93
94\begin{funcdesc}{getfloatmax}{}
95Get the maximum value for floating sample formats;
96equivalent to the C function ALgetfloatmax().
97\end{funcdesc}
98
99\begin{funcdesc}{setfloatmax}{floatmax}
100Set the maximum value for floating sample formats;
101equivalent to the C function ALsetfloatmax().
102\end{funcdesc}
103
104Port objects (returned by \code{al.openport()} have the following
105methods:
106
107\renewcommand{\indexsubitem}{(audio port object method)}
108\begin{funcdesc}{closeport}{}
109Close the port; equivalent to the C function ALcloseport().
110\end{funcdesc}
111
112\begin{funcdesc}{getfd}{}
113Return the file descriptor as an int; equivalent to the C function
114ALgetfd().
115\end{funcdesc}
116
117\begin{funcdesc}{getfilled}{}
118Return the number of filled samples; equivalent to the C function
119ALgetfilled().
120\end{funcdesc}
121
122\begin{funcdesc}{getfillable}{}
123Return the number of fillable samples; equivalent to the C function
124ALgetfillable().
125\end{funcdesc}
126
127\begin{funcdesc}{readsamps}{nsamples}
128Read a number of samples from the queue, blocking if necessary;
129equivalent to the C function ALreadsamples. The data is returned as a
130string containing the raw data (e.g. 2 bytes per sample in big-endian
131byte order (high byte, low byte) if you have set the sample width to 2
132bytes.
133\end{funcdesc}
134
135\begin{funcdesc}{writesamps}{samples}
136Write samples into the queue, blocking if necessary; equivalent to the
137C function ALwritesamples. The samples are encoded as described for
138the \code{readsamps} return value.
139\end{funcdesc}
140
141\begin{funcdesc}{getfillpoint}{}
142Return the `fill point'; equivalent to the C function ALgetfillpoint().
143\end{funcdesc}
144
145\begin{funcdesc}{setfillpoint}{fillpoint}
146Set the `fill point'; equivalent to the C function ALsetfillpoint().
147\end{funcdesc}
148
149\begin{funcdesc}{getconfig}{}
150Return a configuration object containing the current configuration of
151the port; equivalent to the C function ALgetconfig().
152\end{funcdesc}
153
154\begin{funcdesc}{setconfig}{config}
155Set the configuration from the argument, a configuration object;
156equivalent to the C function ALsetconfig().
157\end{funcdesc}
158
159\begin{funcdesc}{getstatus}{list}
160Get status information on last error
161equivalent to C function ALgetstatus().
162\end{funcdesc}
163
164\section{Standard Module \sectcode{AL}}
165\nodename{AL (uppercase)}
166\stmodindex{AL}
167
168This module defines symbolic constants needed to use the built-in
169module \code{al} (see above); they are equivalent to those defined in
170the C header file \file{<audio.h>} except that the name prefix
171\samp{AL_} is omitted. Read the module source for a complete list of
172the defined names. Suggested use:
173
174\bcode\begin{verbatim}
175import al
176from AL import *
177\end{verbatim}\ecode