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