libal.tex 4.97 KB
Newer Older
1
\section{Built-in Module \sectcode{al}}
Guido van Rossum's avatar
Guido van Rossum committed
2
\label{module-al}
3 4
\bimodindex{al}

5 6 7 8 9 10 11 12 13
This module provides access to the audio facilities of the SGI Indy
and Indigo workstations.  See section 3A of the IRIX man pages for
details.  You'll need to read those man pages to understand what these
functions do!  Some of the functions are not available in IRIX
releases before 4.0.5.  Again, see the manual to check whether a
specific function is available on your platform.

All functions and methods defined in this module are equivalent to
the C functions with \samp{AL} prefixed to their name.
14 15 16 17 18 19 20 21 22 23 24 25

Symbolic constants from the C header file \file{<audio.h>} are defined
in the standard module \code{AL}, see below.

\strong{Warning:} the current version of the audio library may dump core
when bad argument values are passed rather than returning an error
status.  Unfortunately, since the precise circumstances under which
this may happen are undocumented and hard to check, the Python
interface can provide no protection against this kind of problems.
(One example is specifying an excessive queue size --- there is no
documented upper limit.)

26
The module defines the following functions:
27 28

\renewcommand{\indexsubitem}{(in module al)}
29

30
\begin{funcdesc}{openport}{name\, direction\optional{\, config}}
31 32 33 34
The name and direction arguments are strings.  The optional config
argument is a configuration object as returned by
\code{al.newconfig()}.  The return value is an \dfn{port object};
methods of port objects are described below.
35 36 37
\end{funcdesc}

\begin{funcdesc}{newconfig}{}
38 39
The return value is a new \dfn{configuration object}; methods of
configuration objects are described below.
40 41 42
\end{funcdesc}

\begin{funcdesc}{queryparams}{device}
43 44
The device argument is an integer.  The return value is a list of
integers containing the data returned by ALqueryparams().
45 46 47
\end{funcdesc}

\begin{funcdesc}{getparams}{device\, list}
48 49
The device argument is an integer.  The list argument is a list such
as returned by \code{queryparams}; it is modified in place (!).
50 51 52
\end{funcdesc}

\begin{funcdesc}{setparams}{device\, list}
53 54
The device argument is an integer.  The list argument is a list such
as returned by \code{al.queryparams}.
55 56
\end{funcdesc}

57 58
\subsection{Configuration Objects}

59 60 61 62
Configuration objects (returned by \code{al.newconfig()} have the
following methods:

\renewcommand{\indexsubitem}{(audio configuration object method)}
63

64
\begin{funcdesc}{getqueuesize}{}
65
Return the queue size.
66 67 68
\end{funcdesc}

\begin{funcdesc}{setqueuesize}{size}
69
Set the queue size.
70 71 72
\end{funcdesc}

\begin{funcdesc}{getwidth}{}
73
Get the sample width.
74 75
\end{funcdesc}

76 77
\begin{funcdesc}{setwidth}{width}
Set the sample width.
78 79 80
\end{funcdesc}

\begin{funcdesc}{getchannels}{}
81
Get the channel count.
82 83 84
\end{funcdesc}

\begin{funcdesc}{setchannels}{nchannels}
85
Set the channel count.
86 87 88
\end{funcdesc}

\begin{funcdesc}{getsampfmt}{}
89
Get the sample format.
90 91 92
\end{funcdesc}

\begin{funcdesc}{setsampfmt}{sampfmt}
93
Set the sample format.
94 95 96
\end{funcdesc}

\begin{funcdesc}{getfloatmax}{}
97
Get the maximum value for floating sample formats.
98 99 100
\end{funcdesc}

\begin{funcdesc}{setfloatmax}{floatmax}
101
Set the maximum value for floating sample formats.
102 103
\end{funcdesc}

104 105
\subsection{Port Objects}

106 107 108 109
Port objects (returned by \code{al.openport()} have the following
methods:

\renewcommand{\indexsubitem}{(audio port object method)}
110

111
\begin{funcdesc}{closeport}{}
112
Close the port.
113 114 115
\end{funcdesc}

\begin{funcdesc}{getfd}{}
116
Return the file descriptor as an int.
117 118 119
\end{funcdesc}

\begin{funcdesc}{getfilled}{}
120
Return the number of filled samples.
121 122 123
\end{funcdesc}

\begin{funcdesc}{getfillable}{}
124
Return the number of fillable samples.
125 126 127
\end{funcdesc}

\begin{funcdesc}{readsamps}{nsamples}
128 129 130 131
Read a number of samples from the queue, blocking if necessary.
Return the data as a string containing the raw data, (e.g., 2 bytes per
sample in big-endian byte order (high byte, low byte) if you have set
the sample width to 2 bytes).
132 133 134
\end{funcdesc}

\begin{funcdesc}{writesamps}{samples}
135 136
Write samples into the queue, blocking if necessary.  The samples are
encoded as described for the \code{readsamps} return value.
137 138 139
\end{funcdesc}

\begin{funcdesc}{getfillpoint}{}
140
Return the `fill point'.
141 142 143
\end{funcdesc}

\begin{funcdesc}{setfillpoint}{fillpoint}
144
Set the `fill point'.
145 146 147 148
\end{funcdesc}

\begin{funcdesc}{getconfig}{}
Return a configuration object containing the current configuration of
149
the port.
150 151 152
\end{funcdesc}

\begin{funcdesc}{setconfig}{config}
153
Set the configuration from the argument, a configuration object.
154 155 156
\end{funcdesc}

\begin{funcdesc}{getstatus}{list}
157
Get status information on last error.
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
\end{funcdesc}

\section{Standard Module \sectcode{AL}}
\nodename{AL (uppercase)}
\stmodindex{AL}

This module defines symbolic constants needed to use the built-in
module \code{al} (see above); they are equivalent to those defined in
the C header file \file{<audio.h>} except that the name prefix
\samp{AL_} is omitted.  Read the module source for a complete list of
the defined names.  Suggested use:

\bcode\begin{verbatim}
import al
from AL import *
\end{verbatim}\ecode