Added section on passing contextual information to logging and documentation for...
[python.git] / Doc / library / al.rst
blobc5f785cd552e90bbed40e226d7aaf4b3ac2c496b
2 :mod:`al` --- Audio functions on the SGI
3 ========================================
5 .. module:: al
6    :platform: IRIX
7    :synopsis: Audio functions on the SGI.
10 This module provides access to the audio facilities of the SGI Indy and Indigo
11 workstations.  See section 3A of the IRIX man pages for details.  You'll need to
12 read those man pages to understand what these functions do!  Some of the
13 functions are not available in IRIX releases before 4.0.5.  Again, see the
14 manual to check whether a specific function is available on your platform.
16 All functions and methods defined in this module are equivalent to the C
17 functions with ``AL`` prefixed to their name.
19 .. index:: module: AL
21 Symbolic constants from the C header file ``<audio.h>`` are defined in the
22 standard module :mod:`AL`, see below.
24 .. warning::
26    The current version of the audio library may dump core when bad argument values
27    are passed rather than returning an error status.  Unfortunately, since the
28    precise circumstances under which this may happen are undocumented and hard to
29    check, the Python interface can provide no protection against this kind of
30    problems. (One example is specifying an excessive queue size --- there is no
31    documented upper limit.)
33 The module defines the following functions:
36 .. function:: openport(name, direction[, config])
38    The name and direction arguments are strings.  The optional *config* argument is
39    a configuration object as returned by :func:`newconfig`.  The return value is an
40    :dfn:`audio port object`; methods of audio port objects are described below.
43 .. function:: newconfig()
45    The return value is a new :dfn:`audio configuration object`; methods of audio
46    configuration objects are described below.
49 .. function:: queryparams(device)
51    The device argument is an integer.  The return value is a list of integers
52    containing the data returned by :cfunc:`ALqueryparams`.
55 .. function:: getparams(device, list)
57    The *device* argument is an integer.  The list argument is a list such as
58    returned by :func:`queryparams`; it is modified in place (!).
61 .. function:: setparams(device, list)
63    The *device* argument is an integer.  The *list* argument is a list such as
64    returned by :func:`queryparams`.
67 .. _al-config-objects:
69 Configuration Objects
70 ---------------------
72 Configuration objects returned by :func:`newconfig` have the following methods:
75 .. method:: audio configuration.getqueuesize()
77    Return the queue size.
80 .. method:: audio configuration.setqueuesize(size)
82    Set the queue size.
85 .. method:: audio configuration.getwidth()
87    Get the sample width.
90 .. method:: audio configuration.setwidth(width)
92    Set the sample width.
95 .. method:: audio configuration.getchannels()
97    Get the channel count.
100 .. method:: audio configuration.setchannels(nchannels)
102    Set the channel count.
105 .. method:: audio configuration.getsampfmt()
107    Get the sample format.
110 .. method:: audio configuration.setsampfmt(sampfmt)
112    Set the sample format.
115 .. method:: audio configuration.getfloatmax()
117    Get the maximum value for floating sample formats.
120 .. method:: audio configuration.setfloatmax(floatmax)
122    Set the maximum value for floating sample formats.
125 .. _al-port-objects:
127 Port Objects
128 ------------
130 Port objects, as returned by :func:`openport`, have the following methods:
133 .. method:: audio port.closeport()
135    Close the port.
138 .. method:: audio port.getfd()
140    Return the file descriptor as an int.
143 .. method:: audio port.getfilled()
145    Return the number of filled samples.
148 .. method:: audio port.getfillable()
150    Return the number of fillable samples.
153 .. method:: audio port.readsamps(nsamples)
155    Read a number of samples from the queue, blocking if necessary. Return the data
156    as a string containing the raw data, (e.g., 2 bytes per sample in big-endian
157    byte order (high byte, low byte) if you have set the sample width to 2 bytes).
160 .. method:: audio port.writesamps(samples)
162    Write samples into the queue, blocking if necessary.  The samples are encoded as
163    described for the :meth:`readsamps` return value.
166 .. method:: audio port.getfillpoint()
168    Return the 'fill point'.
171 .. method:: audio port.setfillpoint(fillpoint)
173    Set the 'fill point'.
176 .. method:: audio port.getconfig()
178    Return a configuration object containing the current configuration of the port.
181 .. method:: audio port.setconfig(config)
183    Set the configuration from the argument, a configuration object.
186 .. method:: audio port.getstatus(list)
188    Get status information on last error.
191 :mod:`AL` --- Constants used with the :mod:`al` module
192 ======================================================
194 .. module:: AL
195    :platform: IRIX
196    :synopsis: Constants used with the al module.
199 This module defines symbolic constants needed to use the built-in module
200 :mod:`al` (see above); they are equivalent to those defined in the C header file
201 ``<audio.h>`` except that the name prefix ``AL_`` is omitted.  Read the module
202 source for a complete list of the defined names.  Suggested use::
204    import al
205    from AL import *