/Doc/library/al.rst

http://unladen-swallow.googlecode.com/ · ReStructuredText · 214 lines · 109 code · 105 blank · 0 comment · 0 complexity · 28c590ceec815b2864ffb194addf14a7 MD5 · raw file

  1. :mod:`al` --- Audio functions on the SGI
  2. ========================================
  3. .. module:: al
  4. :platform: IRIX
  5. :synopsis: Audio functions on the SGI.
  6. :deprecated:
  7. .. deprecated:: 2.6
  8. The :mod:`al` module has been deprecated for removal in Python 3.0.
  9. This module provides access to the audio facilities of the SGI Indy and Indigo
  10. workstations. See section 3A of the IRIX man pages for details. You'll need to
  11. read those man pages to understand what these functions do! Some of the
  12. functions are not available in IRIX releases before 4.0.5. Again, see the
  13. manual to check whether a specific function is available on your platform.
  14. All functions and methods defined in this module are equivalent to the C
  15. functions with ``AL`` prefixed to their name.
  16. .. index:: module: AL
  17. Symbolic constants from the C header file ``<audio.h>`` are defined in the
  18. standard module :mod:`AL`, see below.
  19. .. warning::
  20. The current version of the audio library may dump core when bad argument values
  21. are passed rather than returning an error status. Unfortunately, since the
  22. precise circumstances under which this may happen are undocumented and hard to
  23. check, the Python interface can provide no protection against this kind of
  24. problems. (One example is specifying an excessive queue size --- there is no
  25. documented upper limit.)
  26. The module defines the following functions:
  27. .. function:: openport(name, direction[, config])
  28. The name and direction arguments are strings. The optional *config* argument is
  29. a configuration object as returned by :func:`newconfig`. The return value is an
  30. :dfn:`audio port object`; methods of audio port objects are described below.
  31. .. function:: newconfig()
  32. The return value is a new :dfn:`audio configuration object`; methods of audio
  33. configuration objects are described below.
  34. .. function:: queryparams(device)
  35. The device argument is an integer. The return value is a list of integers
  36. containing the data returned by :cfunc:`ALqueryparams`.
  37. .. function:: getparams(device, list)
  38. The *device* argument is an integer. The list argument is a list such as
  39. returned by :func:`queryparams`; it is modified in place (!).
  40. .. function:: setparams(device, list)
  41. The *device* argument is an integer. The *list* argument is a list such as
  42. returned by :func:`queryparams`.
  43. .. _al-config-objects:
  44. Configuration Objects
  45. ---------------------
  46. Configuration objects returned by :func:`newconfig` have the following methods:
  47. .. method:: audio configuration.getqueuesize()
  48. Return the queue size.
  49. .. method:: audio configuration.setqueuesize(size)
  50. Set the queue size.
  51. .. method:: audio configuration.getwidth()
  52. Get the sample width.
  53. .. method:: audio configuration.setwidth(width)
  54. Set the sample width.
  55. .. method:: audio configuration.getchannels()
  56. Get the channel count.
  57. .. method:: audio configuration.setchannels(nchannels)
  58. Set the channel count.
  59. .. method:: audio configuration.getsampfmt()
  60. Get the sample format.
  61. .. method:: audio configuration.setsampfmt(sampfmt)
  62. Set the sample format.
  63. .. method:: audio configuration.getfloatmax()
  64. Get the maximum value for floating sample formats.
  65. .. method:: audio configuration.setfloatmax(floatmax)
  66. Set the maximum value for floating sample formats.
  67. .. _al-port-objects:
  68. Port Objects
  69. ------------
  70. Port objects, as returned by :func:`openport`, have the following methods:
  71. .. method:: audio port.closeport()
  72. Close the port.
  73. .. method:: audio port.getfd()
  74. Return the file descriptor as an int.
  75. .. method:: audio port.getfilled()
  76. Return the number of filled samples.
  77. .. method:: audio port.getfillable()
  78. Return the number of fillable samples.
  79. .. method:: audio port.readsamps(nsamples)
  80. Read a number of samples from the queue, blocking if necessary. Return the data
  81. as a string containing the raw data, (e.g., 2 bytes per sample in big-endian
  82. byte order (high byte, low byte) if you have set the sample width to 2 bytes).
  83. .. method:: audio port.writesamps(samples)
  84. Write samples into the queue, blocking if necessary. The samples are encoded as
  85. described for the :meth:`readsamps` return value.
  86. .. method:: audio port.getfillpoint()
  87. Return the 'fill point'.
  88. .. method:: audio port.setfillpoint(fillpoint)
  89. Set the 'fill point'.
  90. .. method:: audio port.getconfig()
  91. Return a configuration object containing the current configuration of the port.
  92. .. method:: audio port.setconfig(config)
  93. Set the configuration from the argument, a configuration object.
  94. .. method:: audio port.getstatus(list)
  95. Get status information on last error.
  96. :mod:`AL` --- Constants used with the :mod:`al` module
  97. ======================================================
  98. .. module:: AL
  99. :platform: IRIX
  100. :synopsis: Constants used with the al module.
  101. :deprecated:
  102. .. deprecated:: 2.6
  103. The :mod:`AL` module has been deprecated for removal in Python 3.0.
  104. This module defines symbolic constants needed to use the built-in module
  105. :mod:`al` (see above); they are equivalent to those defined in the C header file
  106. ``<audio.h>`` except that the name prefix ``AL_`` is omitted. Read the module
  107. source for a complete list of the defined names. Suggested use::
  108. import al
  109. from AL import *