Home | History | Annotate | Download | only in library
      1 
      2 :mod:`al` --- Audio functions on the SGI
      3 ========================================
      4 
      5 .. module:: al
      6    :platform: IRIX
      7    :synopsis: Audio functions on the SGI.
      8    :deprecated:
      9 
     10 .. deprecated:: 2.6
     11     The :mod:`al` module has been removed in Python 3.
     12 
     13 
     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.
     19 
     20 All functions and methods defined in this module are equivalent to the C
     21 functions with ``AL`` prefixed to their name.
     22 
     23 .. index:: module: AL
     24 
     25 Symbolic constants from the C header file ``<audio.h>`` are defined in the
     26 standard module :mod:`AL`, see below.
     27 
     28 .. warning::
     29 
     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.)
     36 
     37 The module defines the following functions:
     38 
     39 
     40 .. function:: openport(name, direction[, config])
     41 
     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.
     45 
     46 
     47 .. function:: newconfig()
     48 
     49    The return value is a new :dfn:`audio configuration object`; methods of audio
     50    configuration objects are described below.
     51 
     52 
     53 .. function:: queryparams(device)
     54 
     55    The device argument is an integer.  The return value is a list of integers
     56    containing the data returned by :c:func:`ALqueryparams`.
     57 
     58 
     59 .. function:: getparams(device, list)
     60 
     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 (!).
     63 
     64 
     65 .. function:: setparams(device, list)
     66 
     67    The *device* argument is an integer.  The *list* argument is a list such as
     68    returned by :func:`queryparams`.
     69 
     70 
     71 .. _al-config-objects:
     72 
     73 Configuration Objects
     74 ---------------------
     75 
     76 Configuration objects returned by :func:`newconfig` have the following methods:
     77 
     78 
     79 .. method:: audio configuration.getqueuesize()
     80 
     81    Return the queue size.
     82 
     83 
     84 .. method:: audio configuration.setqueuesize(size)
     85 
     86    Set the queue size.
     87 
     88 
     89 .. method:: audio configuration.getwidth()
     90 
     91    Get the sample width.
     92 
     93 
     94 .. method:: audio configuration.setwidth(width)
     95 
     96    Set the sample width.
     97 
     98 
     99 .. method:: audio configuration.getchannels()
    100 
    101    Get the channel count.
    102 
    103 
    104 .. method:: audio configuration.setchannels(nchannels)
    105 
    106    Set the channel count.
    107 
    108 
    109 .. method:: audio configuration.getsampfmt()
    110 
    111    Get the sample format.
    112 
    113 
    114 .. method:: audio configuration.setsampfmt(sampfmt)
    115 
    116    Set the sample format.
    117 
    118 
    119 .. method:: audio configuration.getfloatmax()
    120 
    121    Get the maximum value for floating sample formats.
    122 
    123 
    124 .. method:: audio configuration.setfloatmax(floatmax)
    125 
    126    Set the maximum value for floating sample formats.
    127 
    128 
    129 .. _al-port-objects:
    130 
    131 Port Objects
    132 ------------
    133 
    134 Port objects, as returned by :func:`openport`, have the following methods:
    135 
    136 
    137 .. method:: audio port.closeport()
    138 
    139    Close the port.
    140 
    141 
    142 .. method:: audio port.getfd()
    143 
    144    Return the file descriptor as an int.
    145 
    146 
    147 .. method:: audio port.getfilled()
    148 
    149    Return the number of filled samples.
    150 
    151 
    152 .. method:: audio port.getfillable()
    153 
    154    Return the number of fillable samples.
    155 
    156 
    157 .. method:: audio port.readsamps(nsamples)
    158 
    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).
    162 
    163 
    164 .. method:: audio port.writesamps(samples)
    165 
    166    Write samples into the queue, blocking if necessary.  The samples are encoded as
    167    described for the :meth:`readsamps` return value.
    168 
    169 
    170 .. method:: audio port.getfillpoint()
    171 
    172    Return the 'fill point'.
    173 
    174 
    175 .. method:: audio port.setfillpoint(fillpoint)
    176 
    177    Set the 'fill point'.
    178 
    179 
    180 .. method:: audio port.getconfig()
    181 
    182    Return a configuration object containing the current configuration of the port.
    183 
    184 
    185 .. method:: audio port.setconfig(config)
    186 
    187    Set the configuration from the argument, a configuration object.
    188 
    189 
    190 .. method:: audio port.getstatus(list)
    191 
    192    Get status information on last error.
    193 
    194 
    195 :mod:`AL` --- Constants used with the :mod:`al` module
    196 ======================================================
    197 
    198 .. module:: AL
    199    :platform: IRIX
    200    :synopsis: Constants used with the al module.
    201    :deprecated:
    202 
    203 .. deprecated:: 2.6
    204    The :mod:`AL` module has been removed in Python 3.
    205 
    206 
    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::
    211 
    212    import al
    213    from AL import *
    214 
    215