Issue #5170: Fixed regression caused when fixing #5768.
[python.git] / Doc / library / al.rst
blob12cec42dba734cabcc5302ce8d75735fa251f0fe
2 :mod:`al` --- Audio functions on the SGI
3 ========================================
5 .. module:: al
6    :platform: IRIX
7    :synopsis: Audio functions on the SGI.
8    :deprecated:
10 .. deprecated:: 2.6
11     The :mod:`al` module has been deprecated for removal in Python 3.0.
14 This module provides access to the audio facilities of the SGI Indy and Indigo
15 workstations.  See section 3A of the IRIX man pages for details.  You'll need to
16 read those man pages to understand what these functions do!  Some of the
17 functions are not available in IRIX releases before 4.0.5.  Again, see the
18 manual to check whether a specific function is available on your platform.
20 All functions and methods defined in this module are equivalent to the C
21 functions with ``AL`` prefixed to their name.
23 .. index:: module: AL
25 Symbolic constants from the C header file ``<audio.h>`` are defined in the
26 standard module :mod:`AL`, see below.
28 .. warning::
30    The current version of the audio library may dump core when bad argument values
31    are passed rather than returning an error status.  Unfortunately, since the
32    precise circumstances under which this may happen are undocumented and hard to
33    check, the Python interface can provide no protection against this kind of
34    problems. (One example is specifying an excessive queue size --- there is no
35    documented upper limit.)
37 The module defines the following functions:
40 .. function:: openport(name, direction[, config])
42    The name and direction arguments are strings.  The optional *config* argument is
43    a configuration object as returned by :func:`newconfig`.  The return value is an
44    :dfn:`audio port object`; methods of audio port objects are described below.
47 .. function:: newconfig()
49    The return value is a new :dfn:`audio configuration object`; methods of audio
50    configuration objects are described below.
53 .. function:: queryparams(device)
55    The device argument is an integer.  The return value is a list of integers
56    containing the data returned by :cfunc:`ALqueryparams`.
59 .. function:: getparams(device, list)
61    The *device* argument is an integer.  The list argument is a list such as
62    returned by :func:`queryparams`; it is modified in place (!).
65 .. function:: setparams(device, list)
67    The *device* argument is an integer.  The *list* argument is a list such as
68    returned by :func:`queryparams`.
71 .. _al-config-objects:
73 Configuration Objects
74 ---------------------
76 Configuration objects returned by :func:`newconfig` have the following methods:
79 .. method:: audio configuration.getqueuesize()
81    Return the queue size.
84 .. method:: audio configuration.setqueuesize(size)
86    Set the queue size.
89 .. method:: audio configuration.getwidth()
91    Get the sample width.
94 .. method:: audio configuration.setwidth(width)
96    Set the sample width.
99 .. method:: audio configuration.getchannels()
101    Get the channel count.
104 .. method:: audio configuration.setchannels(nchannels)
106    Set the channel count.
109 .. method:: audio configuration.getsampfmt()
111    Get the sample format.
114 .. method:: audio configuration.setsampfmt(sampfmt)
116    Set the sample format.
119 .. method:: audio configuration.getfloatmax()
121    Get the maximum value for floating sample formats.
124 .. method:: audio configuration.setfloatmax(floatmax)
126    Set the maximum value for floating sample formats.
129 .. _al-port-objects:
131 Port Objects
132 ------------
134 Port objects, as returned by :func:`openport`, have the following methods:
137 .. method:: audio port.closeport()
139    Close the port.
142 .. method:: audio port.getfd()
144    Return the file descriptor as an int.
147 .. method:: audio port.getfilled()
149    Return the number of filled samples.
152 .. method:: audio port.getfillable()
154    Return the number of fillable samples.
157 .. method:: audio port.readsamps(nsamples)
159    Read a number of samples from the queue, blocking if necessary. Return the data
160    as a string containing the raw data, (e.g., 2 bytes per sample in big-endian
161    byte order (high byte, low byte) if you have set the sample width to 2 bytes).
164 .. method:: audio port.writesamps(samples)
166    Write samples into the queue, blocking if necessary.  The samples are encoded as
167    described for the :meth:`readsamps` return value.
170 .. method:: audio port.getfillpoint()
172    Return the 'fill point'.
175 .. method:: audio port.setfillpoint(fillpoint)
177    Set the 'fill point'.
180 .. method:: audio port.getconfig()
182    Return a configuration object containing the current configuration of the port.
185 .. method:: audio port.setconfig(config)
187    Set the configuration from the argument, a configuration object.
190 .. method:: audio port.getstatus(list)
192    Get status information on last error.
195 :mod:`AL` --- Constants used with the :mod:`al` module
196 ======================================================
198 .. module:: AL
199    :platform: IRIX
200    :synopsis: Constants used with the al module.
201    :deprecated:
203 .. deprecated:: 2.6
204    The :mod:`AL` module has been deprecated for removal in Python 3.0.
207 This module defines symbolic constants needed to use the built-in module
208 :mod:`al` (see above); they are equivalent to those defined in the C header file
209 ``<audio.h>`` except that the name prefix ``AL_`` is omitted.  Read the module
210 source for a complete list of the defined names.  Suggested use::
212    import al
213    from AL import *