libal.tex 5.56 KB
Newer Older
Fred Drake's avatar
Fred Drake committed
1
\section{\module{al} ---
2
         Audio functions on the SGI}
3

4 5
\declaremodule{builtin}{al}
  \platform{IRIX}
6 7
\modulesynopsis{Audio functions on the SGI.}

8

9 10 11 12 13 14 15 16
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
17
the C functions with \samp{AL} prefixed to their name.
18

19
Symbolic constants from the C header file \code{<audio.h>} are
20 21
defined in the standard module
\refmodule[al-constants]{AL}\refstmodindex{AL}, see below.
22

23
\warning{The current version of the audio library may dump core
24 25 26 27 28
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
29
documented upper limit.)}
30

31
The module defines the following functions:
32

33

34
\begin{funcdesc}{openport}{name, direction\optional{, config}}
35 36 37 38
The name and direction arguments are strings.  The optional
\var{config} argument is a configuration object as returned by
\function{newconfig()}.  The return value is an \dfn{audio port
object}; methods of audio port objects are described below.
39 40 41
\end{funcdesc}

\begin{funcdesc}{newconfig}{}
42 43
The return value is a new \dfn{audio configuration object}; methods of
audio configuration objects are described below.
44 45 46
\end{funcdesc}

\begin{funcdesc}{queryparams}{device}
47
The device argument is an integer.  The return value is a list of
48
integers containing the data returned by \cfunction{ALqueryparams()}.
49 50
\end{funcdesc}

51
\begin{funcdesc}{getparams}{device, list}
52 53 54
The \var{device} argument is an integer.  The list argument is a list
such as returned by \function{queryparams()}; it is modified in place
(!).
55 56
\end{funcdesc}

57
\begin{funcdesc}{setparams}{device, list}
58 59
The \var{device} argument is an integer.  The \var{list} argument is a
list such as returned by \function{queryparams()}.
60 61
\end{funcdesc}

62

63
\subsection{Configuration Objects \label{al-config-objects}}
64

65
Configuration objects returned by \function{newconfig()} have the
66 67
following methods:

68
\begin{methoddesc}[audio configuration]{getqueuesize}{}
69
Return the queue size.
70
\end{methoddesc}
71

72
\begin{methoddesc}[audio configuration]{setqueuesize}{size}
73
Set the queue size.
74
\end{methoddesc}
75

76
\begin{methoddesc}[audio configuration]{getwidth}{}
77
Get the sample width.
78
\end{methoddesc}
79

80
\begin{methoddesc}[audio configuration]{setwidth}{width}
81
Set the sample width.
82
\end{methoddesc}
83

84
\begin{methoddesc}[audio configuration]{getchannels}{}
85
Get the channel count.
86
\end{methoddesc}
87

88
\begin{methoddesc}[audio configuration]{setchannels}{nchannels}
89
Set the channel count.
90
\end{methoddesc}
91

92
\begin{methoddesc}[audio configuration]{getsampfmt}{}
93
Get the sample format.
94
\end{methoddesc}
95

96
\begin{methoddesc}[audio configuration]{setsampfmt}{sampfmt}
97
Set the sample format.
98
\end{methoddesc}
99

100
\begin{methoddesc}[audio configuration]{getfloatmax}{}
101
Get the maximum value for floating sample formats.
102
\end{methoddesc}
103

104
\begin{methoddesc}[audio configuration]{setfloatmax}{floatmax}
105
Set the maximum value for floating sample formats.
106 107
\end{methoddesc}

108

109
\subsection{Port Objects \label{al-port-objects}}
110

111
Port objects, as returned by \function{openport()}, have the following
112 113
methods:

114
\begin{methoddesc}[audio port]{closeport}{}
115
Close the port.
116
\end{methoddesc}
117

118
\begin{methoddesc}[audio port]{getfd}{}
119
Return the file descriptor as an int.
120
\end{methoddesc}
121

122
\begin{methoddesc}[audio port]{getfilled}{}
123
Return the number of filled samples.
124
\end{methoddesc}
125

126
\begin{methoddesc}[audio port]{getfillable}{}
127
Return the number of fillable samples.
128
\end{methoddesc}
129

130
\begin{methoddesc}[audio port]{readsamps}{nsamples}
131 132 133 134
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).
135
\end{methoddesc}
136

137
\begin{methoddesc}[audio port]{writesamps}{samples}
138
Write samples into the queue, blocking if necessary.  The samples are
139
encoded as described for the \method{readsamps()} return value.
140
\end{methoddesc}
141

142
\begin{methoddesc}[audio port]{getfillpoint}{}
143
Return the `fill point'.
144
\end{methoddesc}
145

146
\begin{methoddesc}[audio port]{setfillpoint}{fillpoint}
147
Set the `fill point'.
148
\end{methoddesc}
149

150
\begin{methoddesc}[audio port]{getconfig}{}
151
Return a configuration object containing the current configuration of
152
the port.
153
\end{methoddesc}
154

155
\begin{methoddesc}[audio port]{setconfig}{config}
156
Set the configuration from the argument, a configuration object.
157
\end{methoddesc}
158

159
\begin{methoddesc}[audio port]{getstatus}{list}
160
Get status information on last error.
161
\end{methoddesc}
162

163

Fred Drake's avatar
Fred Drake committed
164
\section{\module{AL} ---
165
         Constants used with the \module{al} module}
166

167
\declaremodule[al-constants]{standard}{AL}
168
  \platform{IRIX}
169 170
\modulesynopsis{Constants used with the \module{al} module.}

171 172

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

178
\begin{verbatim}
179 180
import al
from AL import *
181
\end{verbatim}