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