mirror of
https://github.com/larsimmisch/pyalsaaudio.git
synced 2026-06-01 19:07:02 +00:00
0.8 documentation
This commit is contained in:
+188
-123
@@ -11,8 +11,7 @@
|
||||
|
||||
.. moduleauthor:: Casper Wilstrup <cwi@aves.dk>
|
||||
.. moduleauthor:: Lars Immisch <lars@ibp.de>
|
||||
|
||||
|
||||
|
||||
.. % Author of the module code;
|
||||
|
||||
|
||||
@@ -34,37 +33,71 @@ The :mod:`alsaaudio` module defines functions and classes for using ALSA.
|
||||
.. % should be enclosed in \var{...}.
|
||||
|
||||
|
||||
.. function:: pcms([type=PCM_PLAYBACK])
|
||||
|
||||
List available PCM objects by name.
|
||||
|
||||
Items from this list can be used as the `device` keyword argument for the
|
||||
:class:`PCM` constructor).
|
||||
|
||||
Arguments are:
|
||||
|
||||
* *type* - can be either :const:`PCM_CAPTURE` or :const:`PCM_PLAYBACK`
|
||||
(default).
|
||||
|
||||
**Note:**
|
||||
|
||||
For :const:`PCM_PLAYBACK`, the list of device names should be equivalent
|
||||
to the list of device names that ``aplay -L`` displays on the commandline::
|
||||
|
||||
$ aplay -L
|
||||
|
||||
For :const:`PCM_CAPTURE`, the list of device names should be equivalent
|
||||
to the list of device names that ``arecord -L`` displays on the
|
||||
commandline::
|
||||
|
||||
$ arecord -L
|
||||
|
||||
*New in 0.8*
|
||||
|
||||
.. function:: cards()
|
||||
|
||||
List the available cards by name (suitable for PCM objects).
|
||||
List the available cards by name.
|
||||
|
||||
.. function:: mixers([cardindex])
|
||||
.. function:: mixers(cardindex=-1, device='default')
|
||||
|
||||
List the available mixers. The optional *cardindex* specifies which card
|
||||
should be queried. The default is 0.
|
||||
List the available mixers. The arguments are:
|
||||
|
||||
.. class:: PCM(type=PCM_PLAYBACK, mode=PCM_NORMAL, card='default')
|
||||
* *cardindex* - the card index. If this argument is given, the device name
|
||||
is constructed as: 'hw:*cardindex*' and
|
||||
the `device` keyword argument is ignored. ``0`` is the first hardware sound
|
||||
card.
|
||||
|
||||
This class is used to represent a PCM device (both for playback and
|
||||
recording - capture). The arguments are:
|
||||
* *device* - the name of the device on which the mixer resides. The default
|
||||
is ``'default'``.
|
||||
|
||||
* *type* - can be either ``PCM_CAPTURE`` or ``PCM_PLAYBACK`` (default).
|
||||
* *mode* - can be either ``PCM_NONBLOCK``, or ``PCM_NORMAL`` (default).
|
||||
* *card* - specifies the name of the card that should be used.
|
||||
**Note:** For a list of available controls, you can also use ``amixer`` on
|
||||
the commandline::
|
||||
|
||||
$ amixer
|
||||
|
||||
.. class:: Mixer(control='Master', id=0, cardindex=0)
|
||||
To elaborate the example, calling :func:`mixers` with the argument
|
||||
``cardindex=0`` should give the same list of Mixer controls as::
|
||||
|
||||
This class is used to access a specific ALSA mixer. The arguments
|
||||
are:
|
||||
$ amixer -c 0
|
||||
|
||||
* *control* - Name of the chosen mixed (default is 'Master').
|
||||
* *id* - id of mixer -- More explanation needed here
|
||||
* *cardindex* specifies which card should be used.
|
||||
And calling :func:`mixers` with the argument ``device='foo'`` should give
|
||||
the same list of Mixer controls as::
|
||||
|
||||
.. exception:: ALSAAudioError
|
||||
$ amixer -D foo
|
||||
|
||||
*Changed in 0.8*:
|
||||
|
||||
- The keyword argument `device` is new and can be used to
|
||||
select virtual devices. As a result, the default behaviour has subtly
|
||||
changed. Since 0.8, this functions returns the mixers for the default
|
||||
device, not the mixers for the first card.
|
||||
|
||||
Exception raised when an operation fails for a ALSA specific reason. The
|
||||
exception argument is a string describing the reason of the failure.
|
||||
|
||||
.. _pcm-objects:
|
||||
|
||||
@@ -75,39 +108,54 @@ PCM objects in :mod:`alsaaudio` can play or capture (record) PCM
|
||||
sound through speakers or a microphone. The PCM constructor takes the
|
||||
following arguments:
|
||||
|
||||
.. class:: PCM(type=PCM_CAPTURE, mode=PCM_NORMAL, card='default')
|
||||
.. class:: PCM(type=PCM_PLAYBACK, mode=PCM_NORMAL, device='default', cardindex=-1)
|
||||
|
||||
*type* - can be either ``PCM_CAPTURE`` or ``PCM_PLAYBACK`` (default).
|
||||
This class is used to represent a PCM device (either for playback and
|
||||
recording). The arguments are:
|
||||
|
||||
*mode* - can be either ``PCM_NONBLOCK``, or ``PCM_NORMAL`` (the
|
||||
default). In ``PCM_NONBLOCK`` mode, calls to :func:`read` will return
|
||||
immediately independent of whether there is any actual data to
|
||||
read. Similarly, calls to :func:`write` will return immediately without
|
||||
actually writing anything to the playout buffer if the buffer is
|
||||
full [#f1]_.
|
||||
|
||||
*card* - specifies which card should be used. This can be a string
|
||||
like 'default' or a name that was returned from the :func:`cards` function.
|
||||
* *type* - can be either :const:`PCM_CAPTURE` or :const:`PCM_PLAYBACK`
|
||||
(default).
|
||||
* *mode* - can be either :const:`PCM_NONBLOCK`, or :const:`PCM_NORMAL`
|
||||
(default).
|
||||
* *device* - the name of the PCM device that should be used (for example
|
||||
a value from the output of :func:`pcms`). The default value is
|
||||
``'default'``.
|
||||
* *cardindex* - the card index. If this argument is given, the device name
|
||||
is constructed as 'hw:*cardindex*' and
|
||||
the `device` keyword argument is ignored.
|
||||
``0`` is the first hardware sound card.
|
||||
|
||||
This will construct a PCM object with these default settings:
|
||||
|
||||
* Sample format: ``PCM_FORMAT_S16_LE``
|
||||
* Sample format: :const:`PCM_FORMAT_S16_LE`
|
||||
* Rate: 44100 Hz
|
||||
* Channels: 2
|
||||
* Period size: 32 frames
|
||||
|
||||
*Changed in 0.8:*
|
||||
|
||||
- The `card` keyword argument is still supported,
|
||||
but deprecated. Please use `device` instead.
|
||||
|
||||
- The keyword argument `cardindex` was added.
|
||||
|
||||
The `card` keyword is deprecated because it guesses the real ALSA
|
||||
name of the card. This was always fragile and broke some legitimate usecases.
|
||||
|
||||
|
||||
PCM objects have the following methods:
|
||||
|
||||
|
||||
.. method:: PCM.pcmtype()
|
||||
|
||||
Returns the type of PCM object. Either ``PCM_CAPTURE`` or ``PCM_PLAYBACK``.
|
||||
Returns the type of PCM object. Either :const:`PCM_CAPTURE` or
|
||||
:const:`PCM_PLAYBACK`.
|
||||
|
||||
|
||||
.. method:: PCM.pcmmode()
|
||||
|
||||
Return the mode of the PCM object. One of ``PCM_NONBLOCK``, ``PCM_ASYNC``,
|
||||
or ``PCM_NORMAL``
|
||||
Return the mode of the PCM object. One of :const:`PCM_NONBLOCK`,
|
||||
:const:`PCM_ASYNC`, or :const:`PCM_NORMAL`
|
||||
|
||||
|
||||
.. method:: PCM.cardname()
|
||||
@@ -118,14 +166,15 @@ PCM objects have the following methods:
|
||||
.. method:: PCM.setchannels(nchannels)
|
||||
|
||||
Used to set the number of capture or playback channels. Common
|
||||
values are: 1 = mono, 2 = stereo, and 6 = full 6 channel audio. Few
|
||||
sound cards support more than 2 channels
|
||||
values are: ``1`` = mono, ``2`` = stereo, and ``6`` = full 6 channel audio.
|
||||
Few sound cards support more than 2 channels
|
||||
|
||||
|
||||
.. method:: PCM.setrate(rate)
|
||||
|
||||
Set the sample rate in Hz for the device. Typical values are 8000
|
||||
(mainly used for telephony), 16000, 44100 (CD quality), and 96000.
|
||||
Set the sample rate in Hz for the device. Typical values are ``8000``
|
||||
(mainly used for telephony), ``16000``, ``44100`` (CD quality),
|
||||
``48000`` and ``96000``.
|
||||
|
||||
|
||||
.. method:: PCM.setformat(format)
|
||||
@@ -135,52 +184,52 @@ PCM objects have the following methods:
|
||||
|
||||
The following formats are provided by ALSA:
|
||||
|
||||
===================== ===============
|
||||
Format Description
|
||||
===================== ===============
|
||||
PCM_FORMAT_S8 Signed 8 bit samples for each channel
|
||||
PCM_FORMAT_U8 Signed 8 bit samples for each channel
|
||||
PCM_FORMAT_S16_LE Signed 16 bit samples for each channel Little Endian byte order)
|
||||
PCM_FORMAT_S16_BE Signed 16 bit samples for each channel (Big Endian byte order)
|
||||
PCM_FORMAT_U16_LE Unsigned 16 bit samples for each channel (Little Endian byte order)
|
||||
PCM_FORMAT_U16_BE Unsigned 16 bit samples for each channel (Big Endian byte order)
|
||||
PCM_FORMAT_S24_LE Signed 24 bit samples for each channel (Little Endian byte order)
|
||||
PCM_FORMAT_S24_BE Signed 24 bit samples for each channel (Big Endian byte order)}
|
||||
PCM_FORMAT_U24_LE Unsigned 24 bit samples for each channel (Little Endian byte order)
|
||||
PCM_FORMAT_U24_BE Unsigned 24 bit samples for each channel (Big Endian byte order)
|
||||
PCM_FORMAT_S32_LE Signed 32 bit samples for each channel (Little Endian byte order)
|
||||
PCM_FORMAT_S32_BE Signed 32 bit samples for each channel (Big Endian byte order)
|
||||
PCM_FORMAT_U32_LE Unsigned 32 bit samples for each channel (Little Endian byte order)
|
||||
PCM_FORMAT_U32_BE Unsigned 32 bit samples for each channel (Big Endian byte order)
|
||||
PCM_FORMAT_FLOAT_LE 32 bit samples encoded as float (Little Endian byte order)
|
||||
PCM_FORMAT_FLOAT_BE 32 bit samples encoded as float (Big Endian byte order)
|
||||
PCM_FORMAT_FLOAT64_LE 64 bit samples encoded as float (Little Endian byte order)
|
||||
PCM_FORMAT_FLOAT64_BE 64 bit samples encoded as float (Big Endian byte order)
|
||||
PCM_FORMAT_MU_LAW A logarithmic encoding (used by Sun .au files and telephony)
|
||||
PCM_FORMAT_A_LAW Another logarithmic encoding
|
||||
PCM_FORMAT_IMA_ADPCM A 4:1 compressed format defined by the Interactive Multimedia Association.
|
||||
PCM_FORMAT_MPEG MPEG encoded audio?
|
||||
PCM_FORMAT_GSM 9600 bits/s constant rate encoding for speech
|
||||
===================== ===============
|
||||
========================= ===============
|
||||
Format Description
|
||||
========================= ===============
|
||||
``PCM_FORMAT_S8`` Signed 8 bit samples for each channel
|
||||
``PCM_FORMAT_U8`` Signed 8 bit samples for each channel
|
||||
``PCM_FORMAT_S16_LE`` Signed 16 bit samples for each channel Little Endian byte order)
|
||||
``PCM_FORMAT_S16_BE`` Signed 16 bit samples for each channel (Big Endian byte order)
|
||||
``PCM_FORMAT_U16_LE`` Unsigned 16 bit samples for each channel (Little Endian byte order)
|
||||
``PCM_FORMAT_U16_BE`` Unsigned 16 bit samples for each channel (Big Endian byte order)
|
||||
``PCM_FORMAT_S24_LE`` Signed 24 bit samples for each channel (Little Endian byte order)
|
||||
``PCM_FORMAT_S24_BE`` Signed 24 bit samples for each channel (Big Endian byte order)}
|
||||
``PCM_FORMAT_U24_LE`` Unsigned 24 bit samples for each channel (Little Endian byte order)
|
||||
``PCM_FORMAT_U24_BE`` Unsigned 24 bit samples for each channel (Big Endian byte order)
|
||||
``PCM_FORMAT_S32_LE`` Signed 32 bit samples for each channel (Little Endian byte order)
|
||||
``PCM_FORMAT_S32_BE`` Signed 32 bit samples for each channel (Big Endian byte order)
|
||||
``PCM_FORMAT_U32_LE`` Unsigned 32 bit samples for each channel (Little Endian byte order)
|
||||
``PCM_FORMAT_U32_BE`` Unsigned 32 bit samples for each channel (Big Endian byte order)
|
||||
``PCM_FORMAT_FLOAT_LE`` 32 bit samples encoded as float (Little Endian byte order)
|
||||
``PCM_FORMAT_FLOAT_BE`` 32 bit samples encoded as float (Big Endian byte order)
|
||||
``PCM_FORMAT_FLOAT64_LE`` 64 bit samples encoded as float (Little Endian byte order)
|
||||
``PCM_FORMAT_FLOAT64_BE`` 64 bit samples encoded as float (Big Endian byte order)
|
||||
``PCM_FORMAT_MU_LAW`` A logarithmic encoding (used by Sun .au files and telephony)
|
||||
``PCM_FORMAT_A_LAW`` Another logarithmic encoding
|
||||
``PCM_FORMAT_IMA_ADPCM`` A 4:1 compressed format defined by the Interactive Multimedia Association.
|
||||
``PCM_FORMAT_MPEG`` MPEG encoded audio?
|
||||
``PCM_FORMAT_GSM`` 9600 bits/s constant rate encoding for speech
|
||||
========================= ===============
|
||||
|
||||
|
||||
.. method:: PCM.setperiodsize(period)
|
||||
|
||||
Sets the actual period size in frames. Each write should consist of
|
||||
exactly this number of frames, and each read will return this
|
||||
number of frames (unless the device is in ``PCM_NONBLOCK`` mode, in
|
||||
number of frames (unless the device is in :const:`PCM_NONBLOCK` mode, in
|
||||
which case it may return nothing at all)
|
||||
|
||||
|
||||
.. method:: PCM.read()
|
||||
|
||||
In ``PCM_NORMAL`` mode, this function blocks until a full period is
|
||||
In :const:`PCM_NORMAL` mode, this function blocks until a full period is
|
||||
available, and then returns a tuple (length,data) where *length* is
|
||||
the number of frames of captured data, and *data* is the captured
|
||||
sound frames as a string. The length of the returned data will be
|
||||
periodsize\*framesize bytes.
|
||||
|
||||
In ``PCM_NONBLOCK`` mode, the call will not block, but will return
|
||||
In :const:`PCM_NONBLOCK` mode, the call will not block, but will return
|
||||
``(0,'')`` if no new period has become available since the last
|
||||
call to read.
|
||||
|
||||
@@ -192,20 +241,20 @@ PCM objects have the following methods:
|
||||
period. If less than 'period size' frames are provided, the actual
|
||||
playout will not happen until more data is written.
|
||||
|
||||
If the device is not in ``PCM_NONBLOCK`` mode, this call will block if
|
||||
If the device is not in :const:`PCM_NONBLOCK` mode, this call will block if
|
||||
the kernel buffer is full, and until enough sound has been played
|
||||
to allow the sound data to be buffered. The call always returns the
|
||||
size of the data provided.
|
||||
|
||||
In ``PCM_NONBLOCK`` mode, the call will return immediately, with a
|
||||
In :const:`PCM_NONBLOCK` mode, the call will return immediately, with a
|
||||
return value of zero, if the buffer is full. In this case, the data
|
||||
should be written at a later time.
|
||||
|
||||
|
||||
.. method:: PCM.pause([enable=1])
|
||||
.. method:: PCM.pause([enable=True])
|
||||
|
||||
If *enable* is 1, playback or capture is paused. If *enable* is 0,
|
||||
playback/capture is resumed.
|
||||
If *enable* is :const:`True`, playback or capture is paused.
|
||||
Otherwise, playback/capture is resumed.
|
||||
|
||||
**A few hints on using PCM devices for playback**
|
||||
|
||||
@@ -215,10 +264,10 @@ to PCM devices must *exactly* match the data rate of the device.
|
||||
If too little data is written to the device, it will underrun, and
|
||||
ugly clicking sounds will occur. Conversely, of too much data is
|
||||
written to the device, the write function will either block
|
||||
(``PCM_NORMAL`` mode) or return zero (``PCM_NONBLOCK`` mode).
|
||||
(:const:`PCM_NORMAL` mode) or return zero (:const:`PCM_NONBLOCK` mode).
|
||||
|
||||
If your program does nothing but play sound, the best strategy is to put the
|
||||
device in ``PCM_NORMAL`` mode, and just write as much data to the device as
|
||||
device in :const:`PCM_NORMAL` mode, and just write as much data to the device as
|
||||
possible. This strategy can also be achieved by using a separate
|
||||
thread with the sole task of playing out sound.
|
||||
|
||||
@@ -243,23 +292,31 @@ Mixer Objects
|
||||
Mixer objects provides access to the ALSA mixer API.
|
||||
|
||||
|
||||
.. class:: Mixer(control='Master', id=0, cardindex=0)
|
||||
|
||||
*control* - specifies which control to manipulate using this mixer
|
||||
object. The list of available controls can be found with the
|
||||
:mod:`alsaaudio`.\ :func:`mixers` function. The default value is
|
||||
'Master' - other common controls include 'Master Mono', 'PCM', 'Line', etc.
|
||||
|
||||
*id* - the id of the mixer control. Default is 0
|
||||
|
||||
*cardindex* - specifies which card should be used [#f3]_. 0 is the
|
||||
first sound card.
|
||||
.. class:: Mixer(control='Master', id=0, cardindex=-1, device='default')
|
||||
|
||||
Arguments are:
|
||||
|
||||
**Note:** For a list of available controls, you can also use **amixer**::
|
||||
|
||||
amixer
|
||||
* *control* - specifies which control to manipulate using this mixer
|
||||
object. The list of available controls can be found with the
|
||||
:mod:`alsaaudio`.\ :func:`mixers` function. The default value is
|
||||
``'Master'`` - other common controls may be ``'Master Mono'``, ``'PCM'``,
|
||||
``'Line'``, etc.
|
||||
|
||||
* *id* - the id of the mixer control. Default is ``0``.
|
||||
|
||||
* *cardindex* - specifies which card should be used. If this argument
|
||||
is given, the device name is constructed like this: 'hw:*cardindex*' and
|
||||
the `device` keyword argument is ignored. ``0`` is the
|
||||
first sound card.
|
||||
|
||||
* *device* - the name of the device on which the mixer resides. The default
|
||||
value is ``'default'``.
|
||||
|
||||
*Changed in 0.8*:
|
||||
|
||||
- The keyword argument `device` is new and can be used to select virtual
|
||||
devices.
|
||||
|
||||
Mixer objects have the following methods:
|
||||
|
||||
.. method:: Mixer.cardname()
|
||||
@@ -270,7 +327,7 @@ Mixer objects have the following methods:
|
||||
.. method:: Mixer.mixer()
|
||||
|
||||
Return the name of the specific mixer controlled by this object, For example
|
||||
'Master' or 'PCM'
|
||||
``'Master'`` or ``'PCM'``
|
||||
|
||||
|
||||
.. method:: Mixer.mixerid()
|
||||
@@ -354,10 +411,10 @@ Mixer objects have the following methods:
|
||||
|
||||
Return the volume range of the ALSA mixer controlled by this object.
|
||||
|
||||
The optional *direction* argument can be either 'playback' or
|
||||
'capture', which is relevant if the mixer can control both playback
|
||||
and capture volume. The default value is 'playback' if the mixer
|
||||
has this capability, otherwise 'capture'
|
||||
The optional *direction* argument can be either :const:`PCM_PLAYBACK` or
|
||||
:const:`PCM_CAPTURE`, which is relevant if the mixer can control both
|
||||
playback and capture volume. The default value is :const:`PCM_PLAYBACK`
|
||||
if the mixer has playback channels, otherwise it is :const:`PCM_CAPTURE`.
|
||||
|
||||
|
||||
.. method:: Mixer.getrec()
|
||||
@@ -373,13 +430,13 @@ Mixer objects have the following methods:
|
||||
Returns a list with the current volume settings for each channel. The list
|
||||
elements are integer percentages.
|
||||
|
||||
The optional *direction* argument can be either 'playback' or
|
||||
'capture', which is relevant if the mixer can control both playback
|
||||
and capture volume. The default value is 'playback' if the mixer
|
||||
has this capability, otherwise 'capture'
|
||||
The optional *direction* argument can be either :const:`PCM_PLAYBACK` or
|
||||
:const:`PCM_CAPTURE`, which is relevant if the mixer can control both
|
||||
playback and capture volume. The default value is :const:`PCM_PLAYBACK`
|
||||
if the mixer has playback channels, otherwise it is :const:`PCM_CAPTURE`.
|
||||
|
||||
|
||||
.. method:: Mixer.setvolume(volume,[channel], [direction])
|
||||
.. method:: Mixer.setvolume(volume, [channel], [direction])
|
||||
|
||||
Change the current volume settings for this mixer. The *volume* argument
|
||||
controls the new volume setting as an integer percentage.
|
||||
@@ -388,11 +445,10 @@ Mixer objects have the following methods:
|
||||
only for this channel. This assumes that the mixer can control the
|
||||
volume for the channels independently.
|
||||
|
||||
The optional *direction* argument can be either 'playback' or 'capture' is
|
||||
relevant if the mixer has independent playback and capture volume
|
||||
capabilities, and controls which of the volumes if changed. The
|
||||
default is 'playback' if the mixer has this capability, otherwise 'capture'.
|
||||
|
||||
The optional *direction* argument can be either :const:`PCM_PLAYBACK` or
|
||||
:const:`PCM_CAPTURE`, which is relevant if the mixer can control both
|
||||
playback and capture volume. The default value is :const:`PCM_PLAYBACK`
|
||||
if the mixer has playback channels, otherwise it is :const:`PCM_CAPTURE`.
|
||||
|
||||
.. method:: Mixer.setmute(mute, [channel])
|
||||
|
||||
@@ -405,7 +461,7 @@ Mixer objects have the following methods:
|
||||
This method will fail if the mixer has no playback mute capabilities
|
||||
|
||||
|
||||
.. method:: Mixer.setrec(capture,[channel])
|
||||
.. method:: Mixer.setrec(capture, [channel])
|
||||
|
||||
Sets the capture mute flag to a new value. The *capture* argument
|
||||
is either 0 for no capture, or 1 for capture.
|
||||
@@ -425,7 +481,7 @@ Mixer objects have the following methods:
|
||||
The ALSA mixer API is extremely complicated - and hardly documented at all.
|
||||
:mod:`alsaaudio` implements a much simplified way to access this API. In
|
||||
designing the API I've had to make some choices which may limit what can and
|
||||
cannot be controlled through the API. However, If I had chosen to implement the
|
||||
cannot be controlled through the API. However, if I had chosen to implement the
|
||||
full API, I would have reexposed the horrible complexity/documentation ratio of
|
||||
the underlying API. At least the :mod:`alsaaudio` API is easy to
|
||||
understand and use.
|
||||
@@ -469,10 +525,10 @@ or::
|
||||
$ python
|
||||
|
||||
>>> import alsaaudio
|
||||
>>> alsaaudio.cards()
|
||||
>>> alsaaudio.pcms()
|
||||
|
||||
mixertest.py accepts the commandline option *-c <cardindex>*. Card
|
||||
indices start at 0.
|
||||
mixertest.py accepts the commandline options *-d <device>* and
|
||||
*-c <cardindex>*.
|
||||
|
||||
playwav.py
|
||||
~~~~~~~~~~
|
||||
@@ -502,11 +558,13 @@ Play back the recording with::
|
||||
mixertest.py
|
||||
~~~~~~~~~~~~
|
||||
|
||||
Without arguments, **mixertest.py** will list all available *controls*.
|
||||
Without arguments, **mixertest.py** will list all available *controls* on the
|
||||
default soundcard.
|
||||
|
||||
The output might look like this::
|
||||
|
||||
$ ./mixertest.py
|
||||
Available mixer controls:
|
||||
$ ./mixertest.py
|
||||
Available mixer controls:
|
||||
'Master'
|
||||
'Master Mono'
|
||||
'Headphone'
|
||||
@@ -525,27 +583,34 @@ The output might look like this::
|
||||
With a single argument - the *control*, it will display the settings of
|
||||
that control; for example::
|
||||
|
||||
$ ./mixertest.py Master
|
||||
Mixer name: 'Master'
|
||||
Capabilities: Playback Volume Playback Mute
|
||||
Channel 0 volume: 61%
|
||||
Channel 1 volume: 61%
|
||||
$ ./mixertest.py Master
|
||||
Mixer name: 'Master'
|
||||
Capabilities: Playback Volume Playback Mute
|
||||
Channel 0 volume: 61%
|
||||
Channel 1 volume: 61%
|
||||
|
||||
With two arguments, the *control* and a *parameter*, it will set the
|
||||
parameter on the mixer::
|
||||
|
||||
$ ./mixertest.py Master mute
|
||||
$ ./mixertest.py Master mute
|
||||
|
||||
This will mute the Master mixer.
|
||||
|
||||
Or::
|
||||
|
||||
$ ./mixertest.py Master 40
|
||||
$ ./mixertest.py Master 40
|
||||
|
||||
This sets the volume to 40% on all channels.
|
||||
|
||||
To select a different soundcard, use either the *device* or *cardindex*
|
||||
argument::
|
||||
|
||||
$ ./mixertest.py -c 0 Master
|
||||
Mixer name: 'Master'
|
||||
Capabilities: Playback Volume Playback Mute
|
||||
Channel 0 volume: 61%
|
||||
Channel 1 volume: 61%
|
||||
|
||||
.. rubric:: Footnotes
|
||||
|
||||
.. [#f1] ALSA also allows ``PCM_ASYNC``, but this is not supported yet.
|
||||
.. [#f2] :mod:`alsaaudio` will leave any name alone that has a ':' (colon) in it.
|
||||
.. [#f3] This is inconsistent with the PCM objects, which use names, but it is consistent with aplay and amixer.
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
Introduction
|
||||
************
|
||||
|
||||
:Author: Casper Wilstrup
|
||||
:Author: Lars Immisch
|
||||
:Author: Casper Wilstrup <cwi@aves.dk>
|
||||
:Author: Lars Immisch <lars@ibp.de>
|
||||
|
||||
.. |release| replace:: 0.4
|
||||
.. |release| replace:: version
|
||||
|
||||
.. % At minimum, give your name and an email address. You can include a
|
||||
.. % snail-mail address if you like.
|
||||
@@ -116,7 +116,7 @@ First of all, run::
|
||||
|
||||
This is a small test suite that mostly performs consistency tests. If
|
||||
it fails, please file a `bug report
|
||||
<http://sourceforge.net/tracker/?group_id=120651>`_.
|
||||
<https://github.com/larsimmisch/pyalsaaudio/issues>`_.
|
||||
|
||||
To test PCM recordings (on your default soundcard), verify your
|
||||
microphone works, then do::
|
||||
|
||||
+2
-5
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Sphinx stylesheet -- basic theme.
|
||||
*
|
||||
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
@@ -89,6 +89,7 @@ div.sphinxsidebar #searchbox input[type="submit"] {
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* -- search page ----------------------------------------------------------- */
|
||||
@@ -401,10 +402,6 @@ dl.glossary dt {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.refcount {
|
||||
color: #060;
|
||||
}
|
||||
|
||||
.optional {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Sphinx stylesheet -- default theme.
|
||||
*
|
||||
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
||||
+5
-14
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* Sphinx JavaScript utilities for all documentation.
|
||||
*
|
||||
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
@@ -32,7 +32,7 @@ if (!window.console || !console.firebug) {
|
||||
*/
|
||||
jQuery.urldecode = function(x) {
|
||||
return decodeURIComponent(x).replace(/\+/g, ' ');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* small helper function to urlencode strings
|
||||
@@ -61,18 +61,6 @@ jQuery.getQueryParameters = function(s) {
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* small function to check if an array contains
|
||||
* a given item.
|
||||
*/
|
||||
jQuery.contains = function(arr, item) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (arr[i] == item)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* highlight a given string on a jquery object by wrapping it in
|
||||
* span elements with the given class name.
|
||||
@@ -180,6 +168,9 @@ var Documentation = {
|
||||
var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
|
||||
if (terms.length) {
|
||||
var body = $('div.body');
|
||||
if (!body.length) {
|
||||
body = $('body');
|
||||
}
|
||||
window.setTimeout(function() {
|
||||
$.each(terms, function() {
|
||||
body.highlightText(this.toLowerCase(), 'highlighted');
|
||||
|
||||
Vendored
+2
-9404
File diff suppressed because one or more lines are too long
@@ -13,11 +13,11 @@
|
||||
.highlight .gr { color: #FF0000 } /* Generic.Error */
|
||||
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
||||
.highlight .gi { color: #00A000 } /* Generic.Inserted */
|
||||
.highlight .go { color: #303030 } /* Generic.Output */
|
||||
.highlight .go { color: #333333 } /* Generic.Output */
|
||||
.highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
|
||||
.highlight .gs { font-weight: bold } /* Generic.Strong */
|
||||
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
||||
.highlight .gt { color: #0040D0 } /* Generic.Traceback */
|
||||
.highlight .gt { color: #0044DD } /* Generic.Traceback */
|
||||
.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
|
||||
.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
|
||||
.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
|
||||
@@ -40,6 +40,7 @@
|
||||
.highlight .nv { color: #bb60d5 } /* Name.Variable */
|
||||
.highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
|
||||
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
||||
.highlight .mb { color: #208050 } /* Literal.Number.Bin */
|
||||
.highlight .mf { color: #208050 } /* Literal.Number.Float */
|
||||
.highlight .mh { color: #208050 } /* Literal.Number.Hex */
|
||||
.highlight .mi { color: #208050 } /* Literal.Number.Integer */
|
||||
|
||||
+212
-150
@@ -4,38 +4,11 @@
|
||||
*
|
||||
* Sphinx JavaScript utilties for the full-text search.
|
||||
*
|
||||
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* helper function to return a node containing the
|
||||
* search summary for a given text. keywords is a list
|
||||
* of stemmed words, hlwords is the list of normal, unstemmed
|
||||
* words. the first one is used to find the occurance, the
|
||||
* latter for highlighting it.
|
||||
*/
|
||||
|
||||
jQuery.makeSearchSummary = function(text, keywords, hlwords) {
|
||||
var textLower = text.toLowerCase();
|
||||
var start = 0;
|
||||
$.each(keywords, function() {
|
||||
var i = textLower.indexOf(this.toLowerCase());
|
||||
if (i > -1)
|
||||
start = i;
|
||||
});
|
||||
start = Math.max(start - 120, 0);
|
||||
var excerpt = ((start > 0) ? '...' : '') +
|
||||
$.trim(text.substr(start, 240)) +
|
||||
((start + 240 - text.length) ? '...' : '');
|
||||
var rv = $('<div class="context"></div>').text(excerpt);
|
||||
$.each(hlwords, function() {
|
||||
rv = rv.highlightText(this, 'highlighted');
|
||||
});
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Porter Stemmer
|
||||
@@ -220,6 +193,38 @@ var Stemmer = function() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Simple result scoring code.
|
||||
*/
|
||||
var Scorer = {
|
||||
// Implement the following function to further tweak the score for each result
|
||||
// The function takes a result array [filename, title, anchor, descr, score]
|
||||
// and returns the new score.
|
||||
/*
|
||||
score: function(result) {
|
||||
return result[4];
|
||||
},
|
||||
*/
|
||||
|
||||
// query matches the full name of an object
|
||||
objNameMatch: 11,
|
||||
// or matches in the last dotted part of the object name
|
||||
objPartialMatch: 6,
|
||||
// Additive scores depending on the priority of the object
|
||||
objPrio: {0: 15, // used to be importantResults
|
||||
1: 5, // used to be objectResults
|
||||
2: -5}, // used to be unimportantResults
|
||||
// Used when the priority is not in the mapping.
|
||||
objPrioDefault: 0,
|
||||
|
||||
// query found in title
|
||||
title: 15,
|
||||
// query found in terms
|
||||
term: 5
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Search Module
|
||||
*/
|
||||
@@ -239,8 +244,13 @@ var Search = {
|
||||
},
|
||||
|
||||
loadIndex : function(url) {
|
||||
$.ajax({type: "GET", url: url, data: null, success: null,
|
||||
dataType: "script", cache: true});
|
||||
$.ajax({type: "GET", url: url, data: null,
|
||||
dataType: "script", cache: true,
|
||||
complete: function(jqxhr, textstatus) {
|
||||
if (textstatus != "success") {
|
||||
document.getElementById("searchindexloader").src = url;
|
||||
}
|
||||
}});
|
||||
},
|
||||
|
||||
setIndex : function(index) {
|
||||
@@ -268,19 +278,20 @@ var Search = {
|
||||
if (this._pulse_status >= 0)
|
||||
return;
|
||||
function pulse() {
|
||||
var i;
|
||||
Search._pulse_status = (Search._pulse_status + 1) % 4;
|
||||
var dotString = '';
|
||||
for (var i = 0; i < Search._pulse_status; i++)
|
||||
for (i = 0; i < Search._pulse_status; i++)
|
||||
dotString += '.';
|
||||
Search.dots.text(dotString);
|
||||
if (Search._pulse_status > -1)
|
||||
window.setTimeout(pulse, 500);
|
||||
};
|
||||
}
|
||||
pulse();
|
||||
},
|
||||
|
||||
/**
|
||||
* perform a search for something
|
||||
* perform a search for something (or wait until index is loaded)
|
||||
*/
|
||||
performSearch : function(query) {
|
||||
// create the required interface elements
|
||||
@@ -300,41 +311,46 @@ var Search = {
|
||||
this.deferQuery(query);
|
||||
},
|
||||
|
||||
/**
|
||||
* execute search (requires search index to be loaded)
|
||||
*/
|
||||
query : function(query) {
|
||||
var stopwords = ["and","then","into","it","as","are","in","if","for","no","there","their","was","is","be","to","that","but","they","not","such","with","by","a","on","these","of","will","this","near","the","or","at"];
|
||||
var i;
|
||||
var stopwords = ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"];
|
||||
|
||||
// Stem the searchterms and add them to the correct list
|
||||
// stem the searchterms and add them to the correct list
|
||||
var stemmer = new Stemmer();
|
||||
var searchterms = [];
|
||||
var excluded = [];
|
||||
var hlterms = [];
|
||||
var tmp = query.split(/\s+/);
|
||||
var objectterms = [];
|
||||
for (var i = 0; i < tmp.length; i++) {
|
||||
if (tmp[i] != "") {
|
||||
for (i = 0; i < tmp.length; i++) {
|
||||
if (tmp[i] !== "") {
|
||||
objectterms.push(tmp[i].toLowerCase());
|
||||
}
|
||||
|
||||
if ($u.indexOf(stopwords, tmp[i]) != -1 || tmp[i].match(/^\d+$/) ||
|
||||
tmp[i] == "") {
|
||||
if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
|
||||
tmp[i] === "") {
|
||||
// skip this "word"
|
||||
continue;
|
||||
}
|
||||
// stem the word
|
||||
var word = stemmer.stemWord(tmp[i]).toLowerCase();
|
||||
var word = stemmer.stemWord(tmp[i].toLowerCase());
|
||||
var toAppend;
|
||||
// select the correct list
|
||||
if (word[0] == '-') {
|
||||
var toAppend = excluded;
|
||||
toAppend = excluded;
|
||||
word = word.substr(1);
|
||||
}
|
||||
else {
|
||||
var toAppend = searchterms;
|
||||
toAppend = searchterms;
|
||||
hlterms.push(tmp[i].toLowerCase());
|
||||
}
|
||||
// only add if not already in the list
|
||||
if (!$.contains(toAppend, word))
|
||||
if (!$u.contains(toAppend, word))
|
||||
toAppend.push(word);
|
||||
};
|
||||
}
|
||||
var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
|
||||
|
||||
// console.debug('SEARCH: searching for:');
|
||||
@@ -342,89 +358,51 @@ var Search = {
|
||||
// console.info('excluded: ', excluded);
|
||||
|
||||
// prepare search
|
||||
var filenames = this._index.filenames;
|
||||
var titles = this._index.titles;
|
||||
var terms = this._index.terms;
|
||||
var fileMap = {};
|
||||
var files = null;
|
||||
// different result priorities
|
||||
var importantResults = [];
|
||||
var objectResults = [];
|
||||
var regularResults = [];
|
||||
var unimportantResults = [];
|
||||
var titleterms = this._index.titleterms;
|
||||
|
||||
// array of [filename, title, anchor, descr, score]
|
||||
var results = [];
|
||||
$('#search-progress').empty();
|
||||
|
||||
// lookup as object
|
||||
for (var i = 0; i < objectterms.length; i++) {
|
||||
var others = [].concat(objectterms.slice(0,i),
|
||||
objectterms.slice(i+1, objectterms.length))
|
||||
var results = this.performObjectSearch(objectterms[i], others);
|
||||
// Assume first word is most likely to be the object,
|
||||
// other words more likely to be in description.
|
||||
// Therefore put matches for earlier words first.
|
||||
// (Results are eventually used in reverse order).
|
||||
objectResults = results[0].concat(objectResults);
|
||||
importantResults = results[1].concat(importantResults);
|
||||
unimportantResults = results[2].concat(unimportantResults);
|
||||
for (i = 0; i < objectterms.length; i++) {
|
||||
var others = [].concat(objectterms.slice(0, i),
|
||||
objectterms.slice(i+1, objectterms.length));
|
||||
results = results.concat(this.performObjectSearch(objectterms[i], others));
|
||||
}
|
||||
|
||||
// perform the search on the required terms
|
||||
for (var i = 0; i < searchterms.length; i++) {
|
||||
var word = searchterms[i];
|
||||
// no match but word was a required one
|
||||
if ((files = terms[word]) == null)
|
||||
break;
|
||||
if (files.length == undefined) {
|
||||
files = [files];
|
||||
}
|
||||
// create the mapping
|
||||
for (var j = 0; j < files.length; j++) {
|
||||
var file = files[j];
|
||||
if (file in fileMap)
|
||||
fileMap[file].push(word);
|
||||
else
|
||||
fileMap[file] = [word];
|
||||
}
|
||||
// lookup as search terms in fulltext
|
||||
results = results.concat(this.performTermsSearch(searchterms, excluded, terms, Scorer.term))
|
||||
.concat(this.performTermsSearch(searchterms, excluded, titleterms, Scorer.title));
|
||||
|
||||
// let the scorer override scores with a custom scoring function
|
||||
if (Scorer.score) {
|
||||
for (i = 0; i < results.length; i++)
|
||||
results[i][4] = Scorer.score(results[i]);
|
||||
}
|
||||
|
||||
// now check if the files don't contain excluded terms
|
||||
for (var file in fileMap) {
|
||||
var valid = true;
|
||||
|
||||
// check if all requirements are matched
|
||||
if (fileMap[file].length != searchterms.length)
|
||||
continue;
|
||||
|
||||
// ensure that none of the excluded terms is in the
|
||||
// search result.
|
||||
for (var i = 0; i < excluded.length; i++) {
|
||||
if (terms[excluded[i]] == file ||
|
||||
$.contains(terms[excluded[i]] || [], file)) {
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
// now sort the results by score (in opposite order of appearance, since the
|
||||
// display function below uses pop() to retrieve items) and then
|
||||
// alphabetically
|
||||
results.sort(function(a, b) {
|
||||
var left = a[4];
|
||||
var right = b[4];
|
||||
if (left > right) {
|
||||
return 1;
|
||||
} else if (left < right) {
|
||||
return -1;
|
||||
} else {
|
||||
// same score: sort alphabetically
|
||||
left = a[1].toLowerCase();
|
||||
right = b[1].toLowerCase();
|
||||
return (left > right) ? -1 : ((left < right) ? 1 : 0);
|
||||
}
|
||||
|
||||
// if we have still a valid result we can add it
|
||||
// to the result list
|
||||
if (valid)
|
||||
regularResults.push([filenames[file], titles[file], '', null]);
|
||||
}
|
||||
|
||||
// delete unused variables in order to not waste
|
||||
// memory until list is retrieved completely
|
||||
delete filenames, titles, terms;
|
||||
|
||||
// now sort the regular results descending by title
|
||||
regularResults.sort(function(a, b) {
|
||||
var left = a[1].toLowerCase();
|
||||
var right = b[1].toLowerCase();
|
||||
return (left > right) ? -1 : ((left < right) ? 1 : 0);
|
||||
});
|
||||
|
||||
// combine all results
|
||||
var results = unimportantResults.concat(regularResults)
|
||||
.concat(objectResults).concat(importantResults);
|
||||
// for debugging
|
||||
//Search.lastresults = results.slice(); // a copy
|
||||
//console.info('search results:', Search.lastresults);
|
||||
|
||||
// print the results
|
||||
var resultCount = results.length;
|
||||
@@ -433,7 +411,7 @@ var Search = {
|
||||
if (results.length) {
|
||||
var item = results.pop();
|
||||
var listItem = $('<li style="display:none"></li>');
|
||||
if (DOCUMENTATION_OPTIONS.FILE_SUFFIX == '') {
|
||||
if (DOCUMENTATION_OPTIONS.FILE_SUFFIX === '') {
|
||||
// dirhtml builder
|
||||
var dirname = item[0] + '/';
|
||||
if (dirname.match(/\/index\/$/)) {
|
||||
@@ -457,16 +435,18 @@ var Search = {
|
||||
displayNextItem();
|
||||
});
|
||||
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
|
||||
$.get(DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' +
|
||||
item[0] + '.txt', function(data) {
|
||||
if (data != '') {
|
||||
listItem.append($.makeSearchSummary(data, searchterms, hlterms));
|
||||
Search.output.append(listItem);
|
||||
}
|
||||
listItem.slideDown(5, function() {
|
||||
displayNextItem();
|
||||
});
|
||||
}, "text");
|
||||
$.ajax({url: DOCUMENTATION_OPTIONS.URL_ROOT + '_sources/' + item[0] + '.txt',
|
||||
dataType: "text",
|
||||
complete: function(jqxhr, textstatus) {
|
||||
var data = jqxhr.responseText;
|
||||
if (data !== '') {
|
||||
listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
|
||||
}
|
||||
Search.output.append(listItem);
|
||||
listItem.slideDown(5, function() {
|
||||
displayNextItem();
|
||||
});
|
||||
}});
|
||||
} else {
|
||||
// no source available, just display title
|
||||
Search.output.append(listItem);
|
||||
@@ -489,20 +469,32 @@ var Search = {
|
||||
displayNextItem();
|
||||
},
|
||||
|
||||
/**
|
||||
* search for object names
|
||||
*/
|
||||
performObjectSearch : function(object, otherterms) {
|
||||
var filenames = this._index.filenames;
|
||||
var objects = this._index.objects;
|
||||
var objnames = this._index.objnames;
|
||||
var titles = this._index.titles;
|
||||
|
||||
var importantResults = [];
|
||||
var objectResults = [];
|
||||
var unimportantResults = [];
|
||||
var i;
|
||||
var results = [];
|
||||
|
||||
for (var prefix in objects) {
|
||||
for (var name in objects[prefix]) {
|
||||
var fullname = (prefix ? prefix + '.' : '') + name;
|
||||
if (fullname.toLowerCase().indexOf(object) > -1) {
|
||||
var score = 0;
|
||||
var parts = fullname.split('.');
|
||||
// check for different match types: exact matches of full name or
|
||||
// "last name" (i.e. last dotted part)
|
||||
if (fullname == object || parts[parts.length - 1] == object) {
|
||||
score += Scorer.objNameMatch;
|
||||
// matches in last name
|
||||
} else if (parts[parts.length - 1].indexOf(object) > -1) {
|
||||
score += Scorer.objPartialMatch;
|
||||
}
|
||||
var match = objects[prefix][name];
|
||||
var objname = objnames[match[1]][2];
|
||||
var title = titles[match[0]];
|
||||
@@ -512,7 +504,7 @@ var Search = {
|
||||
var haystack = (prefix + ' ' + name + ' ' +
|
||||
objname + ' ' + title).toLowerCase();
|
||||
var allfound = true;
|
||||
for (var i = 0; i < otherterms.length; i++) {
|
||||
for (i = 0; i < otherterms.length; i++) {
|
||||
if (haystack.indexOf(otherterms[i]) == -1) {
|
||||
allfound = false;
|
||||
break;
|
||||
@@ -523,37 +515,107 @@ var Search = {
|
||||
}
|
||||
}
|
||||
var descr = objname + _(', in ') + title;
|
||||
anchor = match[3];
|
||||
if (anchor == '')
|
||||
|
||||
var anchor = match[3];
|
||||
if (anchor === '')
|
||||
anchor = fullname;
|
||||
else if (anchor == '-')
|
||||
anchor = objnames[match[1]][1] + '-' + fullname;
|
||||
result = [filenames[match[0]], fullname, '#'+anchor, descr];
|
||||
switch (match[2]) {
|
||||
case 1: objectResults.push(result); break;
|
||||
case 0: importantResults.push(result); break;
|
||||
case 2: unimportantResults.push(result); break;
|
||||
// add custom score for some objects according to scorer
|
||||
if (Scorer.objPrio.hasOwnProperty(match[2])) {
|
||||
score += Scorer.objPrio[match[2]];
|
||||
} else {
|
||||
score += Scorer.objPrioDefault;
|
||||
}
|
||||
results.push([filenames[match[0]], fullname, '#'+anchor, descr, score]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sort results descending
|
||||
objectResults.sort(function(a, b) {
|
||||
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
|
||||
});
|
||||
return results;
|
||||
},
|
||||
|
||||
importantResults.sort(function(a, b) {
|
||||
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
|
||||
});
|
||||
/**
|
||||
* search for full-text terms in the index
|
||||
*/
|
||||
performTermsSearch : function(searchterms, excluded, terms, score) {
|
||||
var filenames = this._index.filenames;
|
||||
var titles = this._index.titles;
|
||||
|
||||
unimportantResults.sort(function(a, b) {
|
||||
return (a[1] > b[1]) ? -1 : ((a[1] < b[1]) ? 1 : 0);
|
||||
});
|
||||
var i, j, file, files;
|
||||
var fileMap = {};
|
||||
var results = [];
|
||||
|
||||
return [importantResults, objectResults, unimportantResults]
|
||||
// perform the search on the required terms
|
||||
for (i = 0; i < searchterms.length; i++) {
|
||||
var word = searchterms[i];
|
||||
// no match but word was a required one
|
||||
if ((files = terms[word]) === undefined)
|
||||
break;
|
||||
if (files.length === undefined) {
|
||||
files = [files];
|
||||
}
|
||||
// create the mapping
|
||||
for (j = 0; j < files.length; j++) {
|
||||
file = files[j];
|
||||
if (file in fileMap)
|
||||
fileMap[file].push(word);
|
||||
else
|
||||
fileMap[file] = [word];
|
||||
}
|
||||
}
|
||||
|
||||
// now check if the files don't contain excluded terms
|
||||
for (file in fileMap) {
|
||||
var valid = true;
|
||||
|
||||
// check if all requirements are matched
|
||||
if (fileMap[file].length != searchterms.length)
|
||||
continue;
|
||||
|
||||
// ensure that none of the excluded terms is in the search result
|
||||
for (i = 0; i < excluded.length; i++) {
|
||||
if (terms[excluded[i]] == file ||
|
||||
$u.contains(terms[excluded[i]] || [], file)) {
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if we have still a valid result we can add it to the result list
|
||||
if (valid) {
|
||||
results.push([filenames[file], titles[file], '', null, score]);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
},
|
||||
|
||||
/**
|
||||
* helper function to return a node containing the
|
||||
* search summary for a given text. keywords is a list
|
||||
* of stemmed words, hlwords is the list of normal, unstemmed
|
||||
* words. the first one is used to find the occurance, the
|
||||
* latter for highlighting it.
|
||||
*/
|
||||
makeSearchSummary : function(text, keywords, hlwords) {
|
||||
var textLower = text.toLowerCase();
|
||||
var start = 0;
|
||||
$.each(keywords, function() {
|
||||
var i = textLower.indexOf(this.toLowerCase());
|
||||
if (i > -1)
|
||||
start = i;
|
||||
});
|
||||
start = Math.max(start - 120, 0);
|
||||
var excerpt = ((start > 0) ? '...' : '') +
|
||||
$.trim(text.substr(start, 240)) +
|
||||
((start + 240 - text.length) ? '...' : '');
|
||||
var rv = $('<div class="context"></div>').text(excerpt);
|
||||
$.each(hlwords, function() {
|
||||
rv = rv.highlightText(this, 'highlighted');
|
||||
});
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
Search.init();
|
||||
|
||||
+11
-3
@@ -16,12 +16,20 @@
|
||||
* Once the browser is closed the cookie is deleted and the position
|
||||
* reset to the default (expanded).
|
||||
*
|
||||
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
||||
$(function() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// global elements used by the functions.
|
||||
// the 'sidebarbutton' element is defined as global after its
|
||||
// creation, in the add_sidebar_button function
|
||||
@@ -134,7 +142,7 @@ $(function() {
|
||||
var items = document.cookie.split(';');
|
||||
for(var k=0; k<items.length; k++) {
|
||||
var key_val = items[k].split('=');
|
||||
var key = key_val[0];
|
||||
var key = key_val[0].replace(/ /, ""); // strip leading spaces
|
||||
if (key == 'sidebar') {
|
||||
var value = key_val[1];
|
||||
if ((value == 'collapsed') && (!sidebar_is_collapsed()))
|
||||
@@ -148,4 +156,4 @@ $(function() {
|
||||
add_sidebar_button();
|
||||
var sidebarbutton = $('#sidebarbutton');
|
||||
set_position_from_cookie();
|
||||
});
|
||||
});
|
||||
+31
-807
@@ -1,807 +1,31 @@
|
||||
// Underscore.js 1.1.6
|
||||
// (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.
|
||||
// Underscore is freely distributable under the MIT license.
|
||||
// Portions of Underscore are inspired or borrowed from Prototype,
|
||||
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
||||
// For all details and documentation:
|
||||
// http://documentcloud.github.com/underscore
|
||||
|
||||
(function() {
|
||||
|
||||
// Baseline setup
|
||||
// --------------
|
||||
|
||||
// Establish the root object, `window` in the browser, or `global` on the server.
|
||||
var root = this;
|
||||
|
||||
// Save the previous value of the `_` variable.
|
||||
var previousUnderscore = root._;
|
||||
|
||||
// Establish the object that gets returned to break out of a loop iteration.
|
||||
var breaker = {};
|
||||
|
||||
// Save bytes in the minified (but not gzipped) version:
|
||||
var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
|
||||
|
||||
// Create quick reference variables for speed access to core prototypes.
|
||||
var slice = ArrayProto.slice,
|
||||
unshift = ArrayProto.unshift,
|
||||
toString = ObjProto.toString,
|
||||
hasOwnProperty = ObjProto.hasOwnProperty;
|
||||
|
||||
// All **ECMAScript 5** native function implementations that we hope to use
|
||||
// are declared here.
|
||||
var
|
||||
nativeForEach = ArrayProto.forEach,
|
||||
nativeMap = ArrayProto.map,
|
||||
nativeReduce = ArrayProto.reduce,
|
||||
nativeReduceRight = ArrayProto.reduceRight,
|
||||
nativeFilter = ArrayProto.filter,
|
||||
nativeEvery = ArrayProto.every,
|
||||
nativeSome = ArrayProto.some,
|
||||
nativeIndexOf = ArrayProto.indexOf,
|
||||
nativeLastIndexOf = ArrayProto.lastIndexOf,
|
||||
nativeIsArray = Array.isArray,
|
||||
nativeKeys = Object.keys,
|
||||
nativeBind = FuncProto.bind;
|
||||
|
||||
// Create a safe reference to the Underscore object for use below.
|
||||
var _ = function(obj) { return new wrapper(obj); };
|
||||
|
||||
// Export the Underscore object for **CommonJS**, with backwards-compatibility
|
||||
// for the old `require()` API. If we're not in CommonJS, add `_` to the
|
||||
// global object.
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = _;
|
||||
_._ = _;
|
||||
} else {
|
||||
root._ = _;
|
||||
}
|
||||
|
||||
// Current version.
|
||||
_.VERSION = '1.1.6';
|
||||
|
||||
// Collection Functions
|
||||
// --------------------
|
||||
|
||||
// The cornerstone, an `each` implementation, aka `forEach`.
|
||||
// Handles objects implementing `forEach`, arrays, and raw objects.
|
||||
// Delegates to **ECMAScript 5**'s native `forEach` if available.
|
||||
var each = _.each = _.forEach = function(obj, iterator, context) {
|
||||
if (obj == null) return;
|
||||
if (nativeForEach && obj.forEach === nativeForEach) {
|
||||
obj.forEach(iterator, context);
|
||||
} else if (_.isNumber(obj.length)) {
|
||||
for (var i = 0, l = obj.length; i < l; i++) {
|
||||
if (iterator.call(context, obj[i], i, obj) === breaker) return;
|
||||
}
|
||||
} else {
|
||||
for (var key in obj) {
|
||||
if (hasOwnProperty.call(obj, key)) {
|
||||
if (iterator.call(context, obj[key], key, obj) === breaker) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Return the results of applying the iterator to each element.
|
||||
// Delegates to **ECMAScript 5**'s native `map` if available.
|
||||
_.map = function(obj, iterator, context) {
|
||||
var results = [];
|
||||
if (obj == null) return results;
|
||||
if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
|
||||
each(obj, function(value, index, list) {
|
||||
results[results.length] = iterator.call(context, value, index, list);
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
// **Reduce** builds up a single result from a list of values, aka `inject`,
|
||||
// or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
|
||||
_.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
|
||||
var initial = memo !== void 0;
|
||||
if (obj == null) obj = [];
|
||||
if (nativeReduce && obj.reduce === nativeReduce) {
|
||||
if (context) iterator = _.bind(iterator, context);
|
||||
return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
|
||||
}
|
||||
each(obj, function(value, index, list) {
|
||||
if (!initial && index === 0) {
|
||||
memo = value;
|
||||
initial = true;
|
||||
} else {
|
||||
memo = iterator.call(context, memo, value, index, list);
|
||||
}
|
||||
});
|
||||
if (!initial) throw new TypeError("Reduce of empty array with no initial value");
|
||||
return memo;
|
||||
};
|
||||
|
||||
// The right-associative version of reduce, also known as `foldr`.
|
||||
// Delegates to **ECMAScript 5**'s native `reduceRight` if available.
|
||||
_.reduceRight = _.foldr = function(obj, iterator, memo, context) {
|
||||
if (obj == null) obj = [];
|
||||
if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
|
||||
if (context) iterator = _.bind(iterator, context);
|
||||
return memo !== void 0 ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
|
||||
}
|
||||
var reversed = (_.isArray(obj) ? obj.slice() : _.toArray(obj)).reverse();
|
||||
return _.reduce(reversed, iterator, memo, context);
|
||||
};
|
||||
|
||||
// Return the first value which passes a truth test. Aliased as `detect`.
|
||||
_.find = _.detect = function(obj, iterator, context) {
|
||||
var result;
|
||||
any(obj, function(value, index, list) {
|
||||
if (iterator.call(context, value, index, list)) {
|
||||
result = value;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
// Return all the elements that pass a truth test.
|
||||
// Delegates to **ECMAScript 5**'s native `filter` if available.
|
||||
// Aliased as `select`.
|
||||
_.filter = _.select = function(obj, iterator, context) {
|
||||
var results = [];
|
||||
if (obj == null) return results;
|
||||
if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
|
||||
each(obj, function(value, index, list) {
|
||||
if (iterator.call(context, value, index, list)) results[results.length] = value;
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
// Return all the elements for which a truth test fails.
|
||||
_.reject = function(obj, iterator, context) {
|
||||
var results = [];
|
||||
if (obj == null) return results;
|
||||
each(obj, function(value, index, list) {
|
||||
if (!iterator.call(context, value, index, list)) results[results.length] = value;
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
// Determine whether all of the elements match a truth test.
|
||||
// Delegates to **ECMAScript 5**'s native `every` if available.
|
||||
// Aliased as `all`.
|
||||
_.every = _.all = function(obj, iterator, context) {
|
||||
var result = true;
|
||||
if (obj == null) return result;
|
||||
if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
|
||||
each(obj, function(value, index, list) {
|
||||
if (!(result = result && iterator.call(context, value, index, list))) return breaker;
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
// Determine if at least one element in the object matches a truth test.
|
||||
// Delegates to **ECMAScript 5**'s native `some` if available.
|
||||
// Aliased as `any`.
|
||||
var any = _.some = _.any = function(obj, iterator, context) {
|
||||
iterator || (iterator = _.identity);
|
||||
var result = false;
|
||||
if (obj == null) return result;
|
||||
if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
|
||||
each(obj, function(value, index, list) {
|
||||
if (result = iterator.call(context, value, index, list)) return breaker;
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
// Determine if a given value is included in the array or object using `===`.
|
||||
// Aliased as `contains`.
|
||||
_.include = _.contains = function(obj, target) {
|
||||
var found = false;
|
||||
if (obj == null) return found;
|
||||
if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
|
||||
any(obj, function(value) {
|
||||
if (found = value === target) return true;
|
||||
});
|
||||
return found;
|
||||
};
|
||||
|
||||
// Invoke a method (with arguments) on every item in a collection.
|
||||
_.invoke = function(obj, method) {
|
||||
var args = slice.call(arguments, 2);
|
||||
return _.map(obj, function(value) {
|
||||
return (method.call ? method || value : value[method]).apply(value, args);
|
||||
});
|
||||
};
|
||||
|
||||
// Convenience version of a common use case of `map`: fetching a property.
|
||||
_.pluck = function(obj, key) {
|
||||
return _.map(obj, function(value){ return value[key]; });
|
||||
};
|
||||
|
||||
// Return the maximum element or (element-based computation).
|
||||
_.max = function(obj, iterator, context) {
|
||||
if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);
|
||||
var result = {computed : -Infinity};
|
||||
each(obj, function(value, index, list) {
|
||||
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
||||
computed >= result.computed && (result = {value : value, computed : computed});
|
||||
});
|
||||
return result.value;
|
||||
};
|
||||
|
||||
// Return the minimum element (or element-based computation).
|
||||
_.min = function(obj, iterator, context) {
|
||||
if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);
|
||||
var result = {computed : Infinity};
|
||||
each(obj, function(value, index, list) {
|
||||
var computed = iterator ? iterator.call(context, value, index, list) : value;
|
||||
computed < result.computed && (result = {value : value, computed : computed});
|
||||
});
|
||||
return result.value;
|
||||
};
|
||||
|
||||
// Sort the object's values by a criterion produced by an iterator.
|
||||
_.sortBy = function(obj, iterator, context) {
|
||||
return _.pluck(_.map(obj, function(value, index, list) {
|
||||
return {
|
||||
value : value,
|
||||
criteria : iterator.call(context, value, index, list)
|
||||
};
|
||||
}).sort(function(left, right) {
|
||||
var a = left.criteria, b = right.criteria;
|
||||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
}), 'value');
|
||||
};
|
||||
|
||||
// Use a comparator function to figure out at what index an object should
|
||||
// be inserted so as to maintain order. Uses binary search.
|
||||
_.sortedIndex = function(array, obj, iterator) {
|
||||
iterator || (iterator = _.identity);
|
||||
var low = 0, high = array.length;
|
||||
while (low < high) {
|
||||
var mid = (low + high) >> 1;
|
||||
iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
|
||||
}
|
||||
return low;
|
||||
};
|
||||
|
||||
// Safely convert anything iterable into a real, live array.
|
||||
_.toArray = function(iterable) {
|
||||
if (!iterable) return [];
|
||||
if (iterable.toArray) return iterable.toArray();
|
||||
if (_.isArray(iterable)) return iterable;
|
||||
if (_.isArguments(iterable)) return slice.call(iterable);
|
||||
return _.values(iterable);
|
||||
};
|
||||
|
||||
// Return the number of elements in an object.
|
||||
_.size = function(obj) {
|
||||
return _.toArray(obj).length;
|
||||
};
|
||||
|
||||
// Array Functions
|
||||
// ---------------
|
||||
|
||||
// Get the first element of an array. Passing **n** will return the first N
|
||||
// values in the array. Aliased as `head`. The **guard** check allows it to work
|
||||
// with `_.map`.
|
||||
_.first = _.head = function(array, n, guard) {
|
||||
return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
|
||||
};
|
||||
|
||||
// Returns everything but the first entry of the array. Aliased as `tail`.
|
||||
// Especially useful on the arguments object. Passing an **index** will return
|
||||
// the rest of the values in the array from that index onward. The **guard**
|
||||
// check allows it to work with `_.map`.
|
||||
_.rest = _.tail = function(array, index, guard) {
|
||||
return slice.call(array, (index == null) || guard ? 1 : index);
|
||||
};
|
||||
|
||||
// Get the last element of an array.
|
||||
_.last = function(array) {
|
||||
return array[array.length - 1];
|
||||
};
|
||||
|
||||
// Trim out all falsy values from an array.
|
||||
_.compact = function(array) {
|
||||
return _.filter(array, function(value){ return !!value; });
|
||||
};
|
||||
|
||||
// Return a completely flattened version of an array.
|
||||
_.flatten = function(array) {
|
||||
return _.reduce(array, function(memo, value) {
|
||||
if (_.isArray(value)) return memo.concat(_.flatten(value));
|
||||
memo[memo.length] = value;
|
||||
return memo;
|
||||
}, []);
|
||||
};
|
||||
|
||||
// Return a version of the array that does not contain the specified value(s).
|
||||
_.without = function(array) {
|
||||
var values = slice.call(arguments, 1);
|
||||
return _.filter(array, function(value){ return !_.include(values, value); });
|
||||
};
|
||||
|
||||
// Produce a duplicate-free version of the array. If the array has already
|
||||
// been sorted, you have the option of using a faster algorithm.
|
||||
// Aliased as `unique`.
|
||||
_.uniq = _.unique = function(array, isSorted) {
|
||||
return _.reduce(array, function(memo, el, i) {
|
||||
if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) memo[memo.length] = el;
|
||||
return memo;
|
||||
}, []);
|
||||
};
|
||||
|
||||
// Produce an array that contains every item shared between all the
|
||||
// passed-in arrays.
|
||||
_.intersect = function(array) {
|
||||
var rest = slice.call(arguments, 1);
|
||||
return _.filter(_.uniq(array), function(item) {
|
||||
return _.every(rest, function(other) {
|
||||
return _.indexOf(other, item) >= 0;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// Zip together multiple lists into a single array -- elements that share
|
||||
// an index go together.
|
||||
_.zip = function() {
|
||||
var args = slice.call(arguments);
|
||||
var length = _.max(_.pluck(args, 'length'));
|
||||
var results = new Array(length);
|
||||
for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
|
||||
return results;
|
||||
};
|
||||
|
||||
// If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
|
||||
// we need this function. Return the position of the first occurrence of an
|
||||
// item in an array, or -1 if the item is not included in the array.
|
||||
// Delegates to **ECMAScript 5**'s native `indexOf` if available.
|
||||
// If the array is large and already in sort order, pass `true`
|
||||
// for **isSorted** to use binary search.
|
||||
_.indexOf = function(array, item, isSorted) {
|
||||
if (array == null) return -1;
|
||||
var i, l;
|
||||
if (isSorted) {
|
||||
i = _.sortedIndex(array, item);
|
||||
return array[i] === item ? i : -1;
|
||||
}
|
||||
if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
|
||||
for (i = 0, l = array.length; i < l; i++) if (array[i] === item) return i;
|
||||
return -1;
|
||||
};
|
||||
|
||||
|
||||
// Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
|
||||
_.lastIndexOf = function(array, item) {
|
||||
if (array == null) return -1;
|
||||
if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
|
||||
var i = array.length;
|
||||
while (i--) if (array[i] === item) return i;
|
||||
return -1;
|
||||
};
|
||||
|
||||
// Generate an integer Array containing an arithmetic progression. A port of
|
||||
// the native Python `range()` function. See
|
||||
// [the Python documentation](http://docs.python.org/library/functions.html#range).
|
||||
_.range = function(start, stop, step) {
|
||||
if (arguments.length <= 1) {
|
||||
stop = start || 0;
|
||||
start = 0;
|
||||
}
|
||||
step = arguments[2] || 1;
|
||||
|
||||
var len = Math.max(Math.ceil((stop - start) / step), 0);
|
||||
var idx = 0;
|
||||
var range = new Array(len);
|
||||
|
||||
while(idx < len) {
|
||||
range[idx++] = start;
|
||||
start += step;
|
||||
}
|
||||
|
||||
return range;
|
||||
};
|
||||
|
||||
// Function (ahem) Functions
|
||||
// ------------------
|
||||
|
||||
// Create a function bound to a given object (assigning `this`, and arguments,
|
||||
// optionally). Binding with arguments is also known as `curry`.
|
||||
// Delegates to **ECMAScript 5**'s native `Function.bind` if available.
|
||||
// We check for `func.bind` first, to fail fast when `func` is undefined.
|
||||
_.bind = function(func, obj) {
|
||||
if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
|
||||
var args = slice.call(arguments, 2);
|
||||
return function() {
|
||||
return func.apply(obj, args.concat(slice.call(arguments)));
|
||||
};
|
||||
};
|
||||
|
||||
// Bind all of an object's methods to that object. Useful for ensuring that
|
||||
// all callbacks defined on an object belong to it.
|
||||
_.bindAll = function(obj) {
|
||||
var funcs = slice.call(arguments, 1);
|
||||
if (funcs.length == 0) funcs = _.functions(obj);
|
||||
each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
|
||||
return obj;
|
||||
};
|
||||
|
||||
// Memoize an expensive function by storing its results.
|
||||
_.memoize = function(func, hasher) {
|
||||
var memo = {};
|
||||
hasher || (hasher = _.identity);
|
||||
return function() {
|
||||
var key = hasher.apply(this, arguments);
|
||||
return hasOwnProperty.call(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
|
||||
};
|
||||
};
|
||||
|
||||
// Delays a function for the given number of milliseconds, and then calls
|
||||
// it with the arguments supplied.
|
||||
_.delay = function(func, wait) {
|
||||
var args = slice.call(arguments, 2);
|
||||
return setTimeout(function(){ return func.apply(func, args); }, wait);
|
||||
};
|
||||
|
||||
// Defers a function, scheduling it to run after the current call stack has
|
||||
// cleared.
|
||||
_.defer = function(func) {
|
||||
return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
|
||||
};
|
||||
|
||||
// Internal function used to implement `_.throttle` and `_.debounce`.
|
||||
var limit = function(func, wait, debounce) {
|
||||
var timeout;
|
||||
return function() {
|
||||
var context = this, args = arguments;
|
||||
var throttler = function() {
|
||||
timeout = null;
|
||||
func.apply(context, args);
|
||||
};
|
||||
if (debounce) clearTimeout(timeout);
|
||||
if (debounce || !timeout) timeout = setTimeout(throttler, wait);
|
||||
};
|
||||
};
|
||||
|
||||
// Returns a function, that, when invoked, will only be triggered at most once
|
||||
// during a given window of time.
|
||||
_.throttle = function(func, wait) {
|
||||
return limit(func, wait, false);
|
||||
};
|
||||
|
||||
// Returns a function, that, as long as it continues to be invoked, will not
|
||||
// be triggered. The function will be called after it stops being called for
|
||||
// N milliseconds.
|
||||
_.debounce = function(func, wait) {
|
||||
return limit(func, wait, true);
|
||||
};
|
||||
|
||||
// Returns a function that will be executed at most one time, no matter how
|
||||
// often you call it. Useful for lazy initialization.
|
||||
_.once = function(func) {
|
||||
var ran = false, memo;
|
||||
return function() {
|
||||
if (ran) return memo;
|
||||
ran = true;
|
||||
return memo = func.apply(this, arguments);
|
||||
};
|
||||
};
|
||||
|
||||
// Returns the first function passed as an argument to the second,
|
||||
// allowing you to adjust arguments, run code before and after, and
|
||||
// conditionally execute the original function.
|
||||
_.wrap = function(func, wrapper) {
|
||||
return function() {
|
||||
var args = [func].concat(slice.call(arguments));
|
||||
return wrapper.apply(this, args);
|
||||
};
|
||||
};
|
||||
|
||||
// Returns a function that is the composition of a list of functions, each
|
||||
// consuming the return value of the function that follows.
|
||||
_.compose = function() {
|
||||
var funcs = slice.call(arguments);
|
||||
return function() {
|
||||
var args = slice.call(arguments);
|
||||
for (var i=funcs.length-1; i >= 0; i--) {
|
||||
args = [funcs[i].apply(this, args)];
|
||||
}
|
||||
return args[0];
|
||||
};
|
||||
};
|
||||
|
||||
// Returns a function that will only be executed after being called N times.
|
||||
_.after = function(times, func) {
|
||||
return function() {
|
||||
if (--times < 1) { return func.apply(this, arguments); }
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Object Functions
|
||||
// ----------------
|
||||
|
||||
// Retrieve the names of an object's properties.
|
||||
// Delegates to **ECMAScript 5**'s native `Object.keys`
|
||||
_.keys = nativeKeys || function(obj) {
|
||||
if (obj !== Object(obj)) throw new TypeError('Invalid object');
|
||||
var keys = [];
|
||||
for (var key in obj) if (hasOwnProperty.call(obj, key)) keys[keys.length] = key;
|
||||
return keys;
|
||||
};
|
||||
|
||||
// Retrieve the values of an object's properties.
|
||||
_.values = function(obj) {
|
||||
return _.map(obj, _.identity);
|
||||
};
|
||||
|
||||
// Return a sorted list of the function names available on the object.
|
||||
// Aliased as `methods`
|
||||
_.functions = _.methods = function(obj) {
|
||||
return _.filter(_.keys(obj), function(key){ return _.isFunction(obj[key]); }).sort();
|
||||
};
|
||||
|
||||
// Extend a given object with all the properties in passed-in object(s).
|
||||
_.extend = function(obj) {
|
||||
each(slice.call(arguments, 1), function(source) {
|
||||
for (var prop in source) {
|
||||
if (source[prop] !== void 0) obj[prop] = source[prop];
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
|
||||
// Fill in a given object with default properties.
|
||||
_.defaults = function(obj) {
|
||||
each(slice.call(arguments, 1), function(source) {
|
||||
for (var prop in source) {
|
||||
if (obj[prop] == null) obj[prop] = source[prop];
|
||||
}
|
||||
});
|
||||
return obj;
|
||||
};
|
||||
|
||||
// Create a (shallow-cloned) duplicate of an object.
|
||||
_.clone = function(obj) {
|
||||
return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
|
||||
};
|
||||
|
||||
// Invokes interceptor with the obj, and then returns obj.
|
||||
// The primary purpose of this method is to "tap into" a method chain, in
|
||||
// order to perform operations on intermediate results within the chain.
|
||||
_.tap = function(obj, interceptor) {
|
||||
interceptor(obj);
|
||||
return obj;
|
||||
};
|
||||
|
||||
// Perform a deep comparison to check if two objects are equal.
|
||||
_.isEqual = function(a, b) {
|
||||
// Check object identity.
|
||||
if (a === b) return true;
|
||||
// Different types?
|
||||
var atype = typeof(a), btype = typeof(b);
|
||||
if (atype != btype) return false;
|
||||
// Basic equality test (watch out for coercions).
|
||||
if (a == b) return true;
|
||||
// One is falsy and the other truthy.
|
||||
if ((!a && b) || (a && !b)) return false;
|
||||
// Unwrap any wrapped objects.
|
||||
if (a._chain) a = a._wrapped;
|
||||
if (b._chain) b = b._wrapped;
|
||||
// One of them implements an isEqual()?
|
||||
if (a.isEqual) return a.isEqual(b);
|
||||
// Check dates' integer values.
|
||||
if (_.isDate(a) && _.isDate(b)) return a.getTime() === b.getTime();
|
||||
// Both are NaN?
|
||||
if (_.isNaN(a) && _.isNaN(b)) return false;
|
||||
// Compare regular expressions.
|
||||
if (_.isRegExp(a) && _.isRegExp(b))
|
||||
return a.source === b.source &&
|
||||
a.global === b.global &&
|
||||
a.ignoreCase === b.ignoreCase &&
|
||||
a.multiline === b.multiline;
|
||||
// If a is not an object by this point, we can't handle it.
|
||||
if (atype !== 'object') return false;
|
||||
// Check for different array lengths before comparing contents.
|
||||
if (a.length && (a.length !== b.length)) return false;
|
||||
// Nothing else worked, deep compare the contents.
|
||||
var aKeys = _.keys(a), bKeys = _.keys(b);
|
||||
// Different object sizes?
|
||||
if (aKeys.length != bKeys.length) return false;
|
||||
// Recursive comparison of contents.
|
||||
for (var key in a) if (!(key in b) || !_.isEqual(a[key], b[key])) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
// Is a given array or object empty?
|
||||
_.isEmpty = function(obj) {
|
||||
if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
|
||||
for (var key in obj) if (hasOwnProperty.call(obj, key)) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
// Is a given value a DOM element?
|
||||
_.isElement = function(obj) {
|
||||
return !!(obj && obj.nodeType == 1);
|
||||
};
|
||||
|
||||
// Is a given value an array?
|
||||
// Delegates to ECMA5's native Array.isArray
|
||||
_.isArray = nativeIsArray || function(obj) {
|
||||
return toString.call(obj) === '[object Array]';
|
||||
};
|
||||
|
||||
// Is a given variable an arguments object?
|
||||
_.isArguments = function(obj) {
|
||||
return !!(obj && hasOwnProperty.call(obj, 'callee'));
|
||||
};
|
||||
|
||||
// Is a given value a function?
|
||||
_.isFunction = function(obj) {
|
||||
return !!(obj && obj.constructor && obj.call && obj.apply);
|
||||
};
|
||||
|
||||
// Is a given value a string?
|
||||
_.isString = function(obj) {
|
||||
return !!(obj === '' || (obj && obj.charCodeAt && obj.substr));
|
||||
};
|
||||
|
||||
// Is a given value a number?
|
||||
_.isNumber = function(obj) {
|
||||
return !!(obj === 0 || (obj && obj.toExponential && obj.toFixed));
|
||||
};
|
||||
|
||||
// Is the given value `NaN`? `NaN` happens to be the only value in JavaScript
|
||||
// that does not equal itself.
|
||||
_.isNaN = function(obj) {
|
||||
return obj !== obj;
|
||||
};
|
||||
|
||||
// Is a given value a boolean?
|
||||
_.isBoolean = function(obj) {
|
||||
return obj === true || obj === false;
|
||||
};
|
||||
|
||||
// Is a given value a date?
|
||||
_.isDate = function(obj) {
|
||||
return !!(obj && obj.getTimezoneOffset && obj.setUTCFullYear);
|
||||
};
|
||||
|
||||
// Is the given value a regular expression?
|
||||
_.isRegExp = function(obj) {
|
||||
return !!(obj && obj.test && obj.exec && (obj.ignoreCase || obj.ignoreCase === false));
|
||||
};
|
||||
|
||||
// Is a given value equal to null?
|
||||
_.isNull = function(obj) {
|
||||
return obj === null;
|
||||
};
|
||||
|
||||
// Is a given variable undefined?
|
||||
_.isUndefined = function(obj) {
|
||||
return obj === void 0;
|
||||
};
|
||||
|
||||
// Utility Functions
|
||||
// -----------------
|
||||
|
||||
// Run Underscore.js in *noConflict* mode, returning the `_` variable to its
|
||||
// previous owner. Returns a reference to the Underscore object.
|
||||
_.noConflict = function() {
|
||||
root._ = previousUnderscore;
|
||||
return this;
|
||||
};
|
||||
|
||||
// Keep the identity function around for default iterators.
|
||||
_.identity = function(value) {
|
||||
return value;
|
||||
};
|
||||
|
||||
// Run a function **n** times.
|
||||
_.times = function (n, iterator, context) {
|
||||
for (var i = 0; i < n; i++) iterator.call(context, i);
|
||||
};
|
||||
|
||||
// Add your own custom functions to the Underscore object, ensuring that
|
||||
// they're correctly added to the OOP wrapper as well.
|
||||
_.mixin = function(obj) {
|
||||
each(_.functions(obj), function(name){
|
||||
addToWrapper(name, _[name] = obj[name]);
|
||||
});
|
||||
};
|
||||
|
||||
// Generate a unique integer id (unique within the entire client session).
|
||||
// Useful for temporary DOM ids.
|
||||
var idCounter = 0;
|
||||
_.uniqueId = function(prefix) {
|
||||
var id = idCounter++;
|
||||
return prefix ? prefix + id : id;
|
||||
};
|
||||
|
||||
// By default, Underscore uses ERB-style template delimiters, change the
|
||||
// following template settings to use alternative delimiters.
|
||||
_.templateSettings = {
|
||||
evaluate : /<%([\s\S]+?)%>/g,
|
||||
interpolate : /<%=([\s\S]+?)%>/g
|
||||
};
|
||||
|
||||
// JavaScript micro-templating, similar to John Resig's implementation.
|
||||
// Underscore templating handles arbitrary delimiters, preserves whitespace,
|
||||
// and correctly escapes quotes within interpolated code.
|
||||
_.template = function(str, data) {
|
||||
var c = _.templateSettings;
|
||||
var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
|
||||
'with(obj||{}){__p.push(\'' +
|
||||
str.replace(/\\/g, '\\\\')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(c.interpolate, function(match, code) {
|
||||
return "'," + code.replace(/\\'/g, "'") + ",'";
|
||||
})
|
||||
.replace(c.evaluate || null, function(match, code) {
|
||||
return "');" + code.replace(/\\'/g, "'")
|
||||
.replace(/[\r\n\t]/g, ' ') + "__p.push('";
|
||||
})
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\t/g, '\\t')
|
||||
+ "');}return __p.join('');";
|
||||
var func = new Function('obj', tmpl);
|
||||
return data ? func(data) : func;
|
||||
};
|
||||
|
||||
// The OOP Wrapper
|
||||
// ---------------
|
||||
|
||||
// If Underscore is called as a function, it returns a wrapped object that
|
||||
// can be used OO-style. This wrapper holds altered versions of all the
|
||||
// underscore functions. Wrapped objects may be chained.
|
||||
var wrapper = function(obj) { this._wrapped = obj; };
|
||||
|
||||
// Expose `wrapper.prototype` as `_.prototype`
|
||||
_.prototype = wrapper.prototype;
|
||||
|
||||
// Helper function to continue chaining intermediate results.
|
||||
var result = function(obj, chain) {
|
||||
return chain ? _(obj).chain() : obj;
|
||||
};
|
||||
|
||||
// A method to easily add functions to the OOP wrapper.
|
||||
var addToWrapper = function(name, func) {
|
||||
wrapper.prototype[name] = function() {
|
||||
var args = slice.call(arguments);
|
||||
unshift.call(args, this._wrapped);
|
||||
return result(func.apply(_, args), this._chain);
|
||||
};
|
||||
};
|
||||
|
||||
// Add all of the Underscore functions to the wrapper object.
|
||||
_.mixin(_);
|
||||
|
||||
// Add all mutator Array functions to the wrapper.
|
||||
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
|
||||
var method = ArrayProto[name];
|
||||
wrapper.prototype[name] = function() {
|
||||
method.apply(this._wrapped, arguments);
|
||||
return result(this._wrapped, this._chain);
|
||||
};
|
||||
});
|
||||
|
||||
// Add all accessor Array functions to the wrapper.
|
||||
each(['concat', 'join', 'slice'], function(name) {
|
||||
var method = ArrayProto[name];
|
||||
wrapper.prototype[name] = function() {
|
||||
return result(method.apply(this._wrapped, arguments), this._chain);
|
||||
};
|
||||
});
|
||||
|
||||
// Start chaining a wrapped Underscore object.
|
||||
wrapper.prototype.chain = function() {
|
||||
this._chain = true;
|
||||
return this;
|
||||
};
|
||||
|
||||
// Extracts the result from a wrapped and chained object.
|
||||
wrapper.prototype.value = function() {
|
||||
return this._wrapped;
|
||||
};
|
||||
|
||||
})();
|
||||
// Underscore.js 1.3.1
|
||||
// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
|
||||
// Underscore is freely distributable under the MIT license.
|
||||
// Portions of Underscore are inspired or borrowed from Prototype,
|
||||
// Oliver Steele's Functional, and John Resig's Micro-Templating.
|
||||
// For all details and documentation:
|
||||
// http://documentcloud.github.com/underscore
|
||||
(function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
|
||||
c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
|
||||
h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
|
||||
b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e<f;e++){if(e in a&&c.call(d,a[e],e,a)===n)break}else for(e in a)if(b.has(a,e)&&c.call(d,a[e],e,a)===n)break};b.map=b.collect=function(a,c,b){var e=[];if(a==null)return e;if(x&&a.map===x)return a.map(c,b);j(a,function(a,g,h){e[e.length]=c.call(b,a,g,h)});if(a.length===+a.length)e.length=a.length;return e};b.reduce=b.foldl=b.inject=function(a,c,d,e){var f=arguments.length>2;a==
|
||||
null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
|
||||
function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
|
||||
e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
|
||||
function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b<e.computed&&(e={value:a,computed:b})});
|
||||
return e.value};b.shuffle=function(a){var b=[],d;j(a,function(a,f){f==0?b[0]=a:(d=Math.floor(Math.random()*(f+1)),b[f]=b[d],b[d]=a)});return b};b.sortBy=function(a,c,d){return b.pluck(b.map(a,function(a,b,g){return{value:a,criteria:c.call(d,a,b,g)}}).sort(function(a,b){var c=a.criteria,d=b.criteria;return c<d?-1:c>d?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
|
||||
c,d){d||(d=b.identity);for(var e=0,f=a.length;e<f;){var g=e+f>>1;d(a[g])<d(c)?e=g+1:f=g}return e};b.toArray=function(a){return!a?[]:a.toArray?a.toArray():b.isArray(a)?i.call(a):b.isArguments(a)?i.call(a):b.values(a)};b.size=function(a){return b.toArray(a).length};b.first=b.head=function(a,b,d){return b!=null&&!d?i.call(a,0,b):a[0]};b.initial=function(a,b,d){return i.call(a,0,a.length-(b==null||d?1:b))};b.last=function(a,b,d){return b!=null&&!d?i.call(a,Math.max(a.length-b,0)):a[a.length-1]};b.rest=
|
||||
b.tail=function(a,b,d){return i.call(a,b==null||d?1:b)};b.compact=function(a){return b.filter(a,function(a){return!!a})};b.flatten=function(a,c){return b.reduce(a,function(a,e){if(b.isArray(e))return a.concat(c?e:b.flatten(e));a[a.length]=e;return a},[])};b.without=function(a){return b.difference(a,i.call(arguments,1))};b.uniq=b.unique=function(a,c,d){var d=d?b.map(a,d):a,e=[];b.reduce(d,function(d,g,h){if(0==h||(c===true?b.last(d)!=g:!b.include(d,g)))d[d.length]=g,e[e.length]=a[h];return d},[]);
|
||||
return e};b.union=function(){return b.uniq(b.flatten(arguments,true))};b.intersection=b.intersect=function(a){var c=i.call(arguments,1);return b.filter(b.uniq(a),function(a){return b.every(c,function(c){return b.indexOf(c,a)>=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e<c;e++)d[e]=b.pluck(a,""+e);return d};b.indexOf=function(a,c,
|
||||
d){if(a==null)return-1;var e;if(d)return d=b.sortedIndex(a,c),a[d]===c?d:-1;if(p&&a.indexOf===p)return a.indexOf(c);for(d=0,e=a.length;d<e;d++)if(d in a&&a[d]===c)return d;return-1};b.lastIndexOf=function(a,b){if(a==null)return-1;if(D&&a.lastIndexOf===D)return a.lastIndexOf(b);for(var d=a.length;d--;)if(d in a&&a[d]===b)return d;return-1};b.range=function(a,b,d){arguments.length<=1&&(b=a||0,a=0);for(var d=arguments[2]||1,e=Math.max(Math.ceil((b-a)/d),0),f=0,g=Array(e);f<e;)g[f++]=a,a+=d;return g};
|
||||
var F=function(){};b.bind=function(a,c){var d,e;if(a.bind===s&&s)return s.apply(a,i.call(arguments,1));if(!b.isFunction(a))throw new TypeError;e=i.call(arguments,2);return d=function(){if(!(this instanceof d))return a.apply(c,e.concat(i.call(arguments)));F.prototype=a.prototype;var b=new F,g=a.apply(b,e.concat(i.call(arguments)));return Object(g)===g?g:b}};b.bindAll=function(a){var c=i.call(arguments,1);c.length==0&&(c=b.functions(a));j(c,function(c){a[c]=b.bind(a[c],a)});return a};b.memoize=function(a,
|
||||
c){var d={};c||(c=b.identity);return function(){var e=c.apply(this,arguments);return b.has(d,e)?d[e]:d[e]=a.apply(this,arguments)}};b.delay=function(a,b){var d=i.call(arguments,2);return setTimeout(function(){return a.apply(a,d)},b)};b.defer=function(a){return b.delay.apply(b,[a,1].concat(i.call(arguments,1)))};b.throttle=function(a,c){var d,e,f,g,h,i=b.debounce(function(){h=g=false},c);return function(){d=this;e=arguments;var b;f||(f=setTimeout(function(){f=null;h&&a.apply(d,e);i()},c));g?h=true:
|
||||
a.apply(d,e);i();g=true}};b.debounce=function(a,b){var d;return function(){var e=this,f=arguments;clearTimeout(d);d=setTimeout(function(){d=null;a.apply(e,f)},b)}};b.once=function(a){var b=false,d;return function(){if(b)return d;b=true;return d=a.apply(this,arguments)}};b.wrap=function(a,b){return function(){var d=[a].concat(i.call(arguments,0));return b.apply(this,d)}};b.compose=function(){var a=arguments;return function(){for(var b=arguments,d=a.length-1;d>=0;d--)b=[a[d].apply(this,b)];return b[0]}};
|
||||
b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
|
||||
1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
|
||||
b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
|
||||
b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e<a;e++)b.call(d,e)};b.escape=function(a){return(""+a).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),
|
||||
function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
|
||||
u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
|
||||
function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
|
||||
true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* sphinx.websupport utilties for all documentation.
|
||||
*
|
||||
* :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
||||
+9
-14
@@ -1,7 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -17,7 +14,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
URL_ROOT: './',
|
||||
VERSION: '0.8',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
@@ -70,12 +67,6 @@
|
||||
<dt><a href="libalsaaudio.html#module-alsaaudio">alsaaudio (module)</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="libalsaaudio.html#alsaaudio.ALSAAudioError">ALSAAudioError</a>
|
||||
</dt>
|
||||
|
||||
</dl></td>
|
||||
</tr></table>
|
||||
|
||||
@@ -133,7 +124,7 @@
|
||||
<table style="width: 100%" class="indextable genindextable"><tr>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="libalsaaudio.html#alsaaudio.Mixer">Mixer (class in alsaaudio)</a>, <a href="libalsaaudio.html#alsaaudio.Mixer">[1]</a>
|
||||
<dt><a href="libalsaaudio.html#alsaaudio.Mixer">Mixer (class in alsaaudio)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
@@ -161,7 +152,7 @@
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="libalsaaudio.html#alsaaudio.PCM">PCM (class in alsaaudio)</a>, <a href="libalsaaudio.html#alsaaudio.PCM">[1]</a>
|
||||
<dt><a href="libalsaaudio.html#alsaaudio.PCM">PCM (class in alsaaudio)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
@@ -171,6 +162,10 @@
|
||||
</dl></td>
|
||||
<td style="width: 33%" valign="top"><dl>
|
||||
|
||||
<dt><a href="libalsaaudio.html#alsaaudio.pcms">pcms() (in module alsaaudio)</a>
|
||||
</dt>
|
||||
|
||||
|
||||
<dt><a href="libalsaaudio.html#alsaaudio.PCM.pcmtype">pcmtype() (alsaaudio.PCM method)</a>
|
||||
</dt>
|
||||
|
||||
@@ -292,8 +287,8 @@
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2008-2009, Casper Wilstrup, Lars Immisch.
|
||||
Last updated on Apr 30, 2015.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
Last updated on May 13, 2015.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+4
-8
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -15,7 +13,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
URL_ROOT: './',
|
||||
VERSION: '0.8',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
@@ -96,9 +94,7 @@
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h3><a href="#">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">alsaaudio documentation</a><ul>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="reference internal" href="#">alsaaudio documentation</a></li>
|
||||
<li><a class="reference internal" href="#github-pages">Github pages</a></li>
|
||||
<li><a class="reference internal" href="#indices-and-tables">Indices and tables</a></li>
|
||||
</ul>
|
||||
@@ -145,8 +141,8 @@
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2008-2009, Casper Wilstrup, Lars Immisch.
|
||||
Last updated on Apr 30, 2015.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
Last updated on May 13, 2015.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+218
-163
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -15,7 +13,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
URL_ROOT: './',
|
||||
VERSION: '0.8',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
@@ -53,88 +51,127 @@
|
||||
<div class="section" id="module-alsaaudio">
|
||||
<span id="alsaaudio"></span><h1><a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><tt class="xref py py-mod docutils literal"><span class="pre">alsaaudio</span></tt></a><a class="headerlink" href="#module-alsaaudio" title="Permalink to this headline">¶</a></h1>
|
||||
<p>The <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><tt class="xref py py-mod docutils literal"><span class="pre">alsaaudio</span></tt></a> module defines functions and classes for using ALSA.</p>
|
||||
<dl class="function">
|
||||
<dt id="alsaaudio.pcms">
|
||||
<tt class="descclassname">alsaaudio.</tt><tt class="descname">pcms</tt><big>(</big><span class="optional">[</span><em>type=PCM_PLAYBACK</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#alsaaudio.pcms" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>List available PCM objects by name.</p>
|
||||
<p>Items from this list can be used as the <cite>device</cite> keyword argument for the
|
||||
<a class="reference internal" href="#alsaaudio.PCM" title="alsaaudio.PCM"><tt class="xref py py-class docutils literal"><span class="pre">PCM</span></tt></a> constructor).</p>
|
||||
<p>Arguments are:</p>
|
||||
<ul class="simple">
|
||||
<li><em>type</em> - can be either <tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt> or <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt>
|
||||
(default).</li>
|
||||
</ul>
|
||||
<p><strong>Note:</strong></p>
|
||||
<p>For <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt>, the list of device names should be equivalent
|
||||
to the list of device names that <tt class="docutils literal"><span class="pre">aplay</span> <span class="pre">-L</span></tt> displays on the commandline:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ aplay -L
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>For <tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt>, the list of device names should be equivalent
|
||||
to the list of device names that <tt class="docutils literal"><span class="pre">arecord</span> <span class="pre">-L</span></tt> displays on the
|
||||
commandline:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ arecord -L
|
||||
</pre></div>
|
||||
</div>
|
||||
<p><em>New in 0.8</em></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="alsaaudio.cards">
|
||||
<tt class="descclassname">alsaaudio.</tt><tt class="descname">cards</tt><big>(</big><big>)</big><a class="headerlink" href="#alsaaudio.cards" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>List the available cards by name (suitable for PCM objects).</p>
|
||||
<dd><p>List the available cards by name.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="alsaaudio.mixers">
|
||||
<tt class="descclassname">alsaaudio.</tt><tt class="descname">mixers</tt><big>(</big><span class="optional">[</span><em>cardindex</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#alsaaudio.mixers" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>List the available mixers. The optional <em>cardindex</em> specifies which card
|
||||
should be queried. The default is 0.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="alsaaudio.PCM">
|
||||
<em class="property">class </em><tt class="descclassname">alsaaudio.</tt><tt class="descname">PCM</tt><big>(</big><em>type=PCM_PLAYBACK</em>, <em>mode=PCM_NORMAL</em>, <em>card='default'</em><big>)</big><a class="headerlink" href="#alsaaudio.PCM" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>This class is used to represent a PCM device (both for playback and
|
||||
recording - capture). The arguments are:</p>
|
||||
<tt class="descclassname">alsaaudio.</tt><tt class="descname">mixers</tt><big>(</big><em>cardindex=-1</em>, <em>device='default'</em><big>)</big><a class="headerlink" href="#alsaaudio.mixers" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>List the available mixers. The arguments are:</p>
|
||||
<ul class="simple">
|
||||
<li><em>type</em> - can be either <tt class="docutils literal"><span class="pre">PCM_CAPTURE</span></tt> or <tt class="docutils literal"><span class="pre">PCM_PLAYBACK</span></tt> (default).</li>
|
||||
<li><em>mode</em> - can be either <tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt>, or <tt class="docutils literal"><span class="pre">PCM_NORMAL</span></tt> (default).</li>
|
||||
<li><em>card</em> - specifies the name of the card that should be used.</li>
|
||||
<li><em>cardindex</em> - the card index. If this argument is given, the device name
|
||||
is constructed as: ‘hw:<em>cardindex</em>‘ and
|
||||
the <cite>device</cite> keyword argument is ignored. <tt class="docutils literal"><span class="pre">0</span></tt> is the first hardware sound
|
||||
card.</li>
|
||||
<li><em>device</em> - the name of the device on which the mixer resides. The default
|
||||
is <tt class="docutils literal"><span class="pre">'default'</span></tt>.</li>
|
||||
</ul>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="class">
|
||||
<dt id="alsaaudio.Mixer">
|
||||
<em class="property">class </em><tt class="descclassname">alsaaudio.</tt><tt class="descname">Mixer</tt><big>(</big><em>control='Master'</em>, <em>id=0</em>, <em>cardindex=0</em><big>)</big><a class="headerlink" href="#alsaaudio.Mixer" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>This class is used to access a specific ALSA mixer. The arguments
|
||||
are:</p>
|
||||
<p><strong>Note:</strong> For a list of available controls, you can also use <tt class="docutils literal"><span class="pre">amixer</span></tt> on
|
||||
the commandline:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ amixer
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>To elaborate the example, calling <a class="reference internal" href="#alsaaudio.mixers" title="alsaaudio.mixers"><tt class="xref py py-func docutils literal"><span class="pre">mixers()</span></tt></a> with the argument
|
||||
<tt class="docutils literal"><span class="pre">cardindex=0</span></tt> should give the same list of Mixer controls as:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ amixer -c 0
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>And calling <a class="reference internal" href="#alsaaudio.mixers" title="alsaaudio.mixers"><tt class="xref py py-func docutils literal"><span class="pre">mixers()</span></tt></a> with the argument <tt class="docutils literal"><span class="pre">device='foo'</span></tt> should give
|
||||
the same list of Mixer controls as:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ amixer -D foo
|
||||
</pre></div>
|
||||
</div>
|
||||
<p><em>Changed in 0.8</em>:</p>
|
||||
<ul class="simple">
|
||||
<li><em>control</em> - Name of the chosen mixed (default is ‘Master’).</li>
|
||||
<li><em>id</em> - id of mixer – More explanation needed here</li>
|
||||
<li><em>cardindex</em> specifies which card should be used.</li>
|
||||
<li>The keyword argument <cite>device</cite> is new and can be used to
|
||||
select virtual devices. As a result, the default behaviour has subtly
|
||||
changed. Since 0.8, this functions returns the mixers for the default
|
||||
device, not the mixers for the first card.</li>
|
||||
</ul>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="exception">
|
||||
<dt id="alsaaudio.ALSAAudioError">
|
||||
<em class="property">exception </em><tt class="descclassname">alsaaudio.</tt><tt class="descname">ALSAAudioError</tt><a class="headerlink" href="#alsaaudio.ALSAAudioError" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Exception raised when an operation fails for a ALSA specific reason. The
|
||||
exception argument is a string describing the reason of the failure.</p>
|
||||
</dd></dl>
|
||||
|
||||
<div class="section" id="pcm-objects">
|
||||
<span id="id1"></span><h2>PCM Objects<a class="headerlink" href="#pcm-objects" title="Permalink to this headline">¶</a></h2>
|
||||
<p>PCM objects in <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><tt class="xref py py-mod docutils literal"><span class="pre">alsaaudio</span></tt></a> can play or capture (record) PCM
|
||||
sound through speakers or a microphone. The PCM constructor takes the
|
||||
following arguments:</p>
|
||||
<dl class="class">
|
||||
<dt>
|
||||
<em class="property">class </em><tt class="descclassname">alsaaudio.</tt><tt class="descname">PCM</tt><big>(</big><em>type=PCM_CAPTURE</em>, <em>mode=PCM_NORMAL</em>, <em>card='default'</em><big>)</big></dt>
|
||||
<dd><p><em>type</em> - can be either <tt class="docutils literal"><span class="pre">PCM_CAPTURE</span></tt> or <tt class="docutils literal"><span class="pre">PCM_PLAYBACK</span></tt> (default).</p>
|
||||
<p><em>mode</em> - can be either <tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt>, or <tt class="docutils literal"><span class="pre">PCM_NORMAL</span></tt> (the
|
||||
default). In <tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, calls to <a class="reference internal" href="#alsaaudio.PCM.read" title="alsaaudio.PCM.read"><tt class="xref py py-func docutils literal"><span class="pre">read()</span></tt></a> will return
|
||||
immediately independent of whether there is any actual data to
|
||||
read. Similarly, calls to <a class="reference internal" href="#alsaaudio.PCM.write" title="alsaaudio.PCM.write"><tt class="xref py py-func docutils literal"><span class="pre">write()</span></tt></a> will return immediately without
|
||||
actually writing anything to the playout buffer if the buffer is
|
||||
full <a class="footnote-reference" href="#f1" id="id2">[1]</a>.</p>
|
||||
<p><em>card</em> - specifies which card should be used. This can be a string
|
||||
like ‘default’ or a name that was returned from the <a class="reference internal" href="#alsaaudio.cards" title="alsaaudio.cards"><tt class="xref py py-func docutils literal"><span class="pre">cards()</span></tt></a> function.</p>
|
||||
<dt id="alsaaudio.PCM">
|
||||
<em class="property">class </em><tt class="descclassname">alsaaudio.</tt><tt class="descname">PCM</tt><big>(</big><em>type=PCM_PLAYBACK</em>, <em>mode=PCM_NORMAL</em>, <em>device='default'</em>, <em>cardindex=-1</em><big>)</big><a class="headerlink" href="#alsaaudio.PCM" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>This class is used to represent a PCM device (either for playback and
|
||||
recording). The arguments are:</p>
|
||||
<ul class="simple">
|
||||
<li><em>type</em> - can be either <tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt> or <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt>
|
||||
(default).</li>
|
||||
<li><em>mode</em> - can be either <tt class="xref py py-const docutils literal"><span class="pre">PCM_NONBLOCK</span></tt>, or <tt class="xref py py-const docutils literal"><span class="pre">PCM_NORMAL</span></tt>
|
||||
(default).</li>
|
||||
<li><em>device</em> - the name of the PCM device that should be used (for example
|
||||
a value from the output of <a class="reference internal" href="#alsaaudio.pcms" title="alsaaudio.pcms"><tt class="xref py py-func docutils literal"><span class="pre">pcms()</span></tt></a>). The default value is
|
||||
<tt class="docutils literal"><span class="pre">'default'</span></tt>.</li>
|
||||
<li><em>cardindex</em> - the card index. If this argument is given, the device name
|
||||
is constructed as ‘hw:<em>cardindex</em>‘ and
|
||||
the <cite>device</cite> keyword argument is ignored.
|
||||
<tt class="docutils literal"><span class="pre">0</span></tt> is the first hardware sound card.</li>
|
||||
</ul>
|
||||
<p>This will construct a PCM object with these default settings:</p>
|
||||
<ul class="simple">
|
||||
<li>Sample format: <tt class="docutils literal"><span class="pre">PCM_FORMAT_S16_LE</span></tt></li>
|
||||
<li>Sample format: <tt class="xref py py-const docutils literal"><span class="pre">PCM_FORMAT_S16_LE</span></tt></li>
|
||||
<li>Rate: 44100 Hz</li>
|
||||
<li>Channels: 2</li>
|
||||
<li>Period size: 32 frames</li>
|
||||
</ul>
|
||||
<p><em>Changed in 0.8:</em></p>
|
||||
<ul class="simple">
|
||||
<li>The <cite>card</cite> keyword argument is still supported,
|
||||
but deprecated. Please use <cite>device</cite> instead.</li>
|
||||
<li>The keyword argument <cite>cardindex</cite> was added.</li>
|
||||
</ul>
|
||||
<p>The <cite>card</cite> keyword is deprecated because it guesses the real ALSA
|
||||
name of the card. This was always fragile and broke some legitimate usecases.</p>
|
||||
</dd></dl>
|
||||
|
||||
<p>PCM objects have the following methods:</p>
|
||||
<dl class="method">
|
||||
<dt id="alsaaudio.PCM.pcmtype">
|
||||
<tt class="descclassname">PCM.</tt><tt class="descname">pcmtype</tt><big>(</big><big>)</big><a class="headerlink" href="#alsaaudio.PCM.pcmtype" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns the type of PCM object. Either <tt class="docutils literal"><span class="pre">PCM_CAPTURE</span></tt> or <tt class="docutils literal"><span class="pre">PCM_PLAYBACK</span></tt>.</p>
|
||||
<dd><p>Returns the type of PCM object. Either <tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt> or
|
||||
<tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="alsaaudio.PCM.pcmmode">
|
||||
<tt class="descclassname">PCM.</tt><tt class="descname">pcmmode</tt><big>(</big><big>)</big><a class="headerlink" href="#alsaaudio.PCM.pcmmode" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Return the mode of the PCM object. One of <tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt>, <tt class="docutils literal"><span class="pre">PCM_ASYNC</span></tt>,
|
||||
or <tt class="docutils literal"><span class="pre">PCM_NORMAL</span></tt></p>
|
||||
<dd><p>Return the mode of the PCM object. One of <tt class="xref py py-const docutils literal"><span class="pre">PCM_NONBLOCK</span></tt>,
|
||||
<tt class="xref py py-const docutils literal"><span class="pre">PCM_ASYNC</span></tt>, or <tt class="xref py py-const docutils literal"><span class="pre">PCM_NORMAL</span></tt></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
@@ -147,15 +184,16 @@ or <tt class="docutils literal"><span class="pre">PCM_NORMAL</span></tt></p>
|
||||
<dt id="alsaaudio.PCM.setchannels">
|
||||
<tt class="descclassname">PCM.</tt><tt class="descname">setchannels</tt><big>(</big><em>nchannels</em><big>)</big><a class="headerlink" href="#alsaaudio.PCM.setchannels" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Used to set the number of capture or playback channels. Common
|
||||
values are: 1 = mono, 2 = stereo, and 6 = full 6 channel audio. Few
|
||||
sound cards support more than 2 channels</p>
|
||||
values are: <tt class="docutils literal"><span class="pre">1</span></tt> = mono, <tt class="docutils literal"><span class="pre">2</span></tt> = stereo, and <tt class="docutils literal"><span class="pre">6</span></tt> = full 6 channel audio.
|
||||
Few sound cards support more than 2 channels</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="alsaaudio.PCM.setrate">
|
||||
<tt class="descclassname">PCM.</tt><tt class="descname">setrate</tt><big>(</big><em>rate</em><big>)</big><a class="headerlink" href="#alsaaudio.PCM.setrate" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Set the sample rate in Hz for the device. Typical values are 8000
|
||||
(mainly used for telephony), 16000, 44100 (CD quality), and 96000.</p>
|
||||
<dd><p>Set the sample rate in Hz for the device. Typical values are <tt class="docutils literal"><span class="pre">8000</span></tt>
|
||||
(mainly used for telephony), <tt class="docutils literal"><span class="pre">16000</span></tt>, <tt class="docutils literal"><span class="pre">44100</span></tt> (CD quality),
|
||||
<tt class="docutils literal"><span class="pre">48000</span></tt> and <tt class="docutils literal"><span class="pre">96000</span></tt>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
@@ -166,8 +204,8 @@ interpret data for playback, and how data is encoded in captures.</p>
|
||||
<p>The following formats are provided by ALSA:</p>
|
||||
<table border="1" class="docutils">
|
||||
<colgroup>
|
||||
<col width="22%" />
|
||||
<col width="78%" />
|
||||
<col width="25%" />
|
||||
<col width="75%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr class="row-odd"><th class="head">Format</th>
|
||||
@@ -175,73 +213,73 @@ interpret data for playback, and how data is encoded in captures.</p>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr class="row-even"><td>PCM_FORMAT_S8</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_S8</span></tt></td>
|
||||
<td>Signed 8 bit samples for each channel</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_U8</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_U8</span></tt></td>
|
||||
<td>Signed 8 bit samples for each channel</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_S16_LE</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_S16_LE</span></tt></td>
|
||||
<td>Signed 16 bit samples for each channel Little Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_S16_BE</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_S16_BE</span></tt></td>
|
||||
<td>Signed 16 bit samples for each channel (Big Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_U16_LE</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_U16_LE</span></tt></td>
|
||||
<td>Unsigned 16 bit samples for each channel (Little Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_U16_BE</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_U16_BE</span></tt></td>
|
||||
<td>Unsigned 16 bit samples for each channel (Big Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_S24_LE</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_S24_LE</span></tt></td>
|
||||
<td>Signed 24 bit samples for each channel (Little Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_S24_BE</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_S24_BE</span></tt></td>
|
||||
<td>Signed 24 bit samples for each channel (Big Endian byte order)}</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_U24_LE</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_U24_LE</span></tt></td>
|
||||
<td>Unsigned 24 bit samples for each channel (Little Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_U24_BE</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_U24_BE</span></tt></td>
|
||||
<td>Unsigned 24 bit samples for each channel (Big Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_S32_LE</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_S32_LE</span></tt></td>
|
||||
<td>Signed 32 bit samples for each channel (Little Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_S32_BE</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_S32_BE</span></tt></td>
|
||||
<td>Signed 32 bit samples for each channel (Big Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_U32_LE</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_U32_LE</span></tt></td>
|
||||
<td>Unsigned 32 bit samples for each channel (Little Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_U32_BE</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_U32_BE</span></tt></td>
|
||||
<td>Unsigned 32 bit samples for each channel (Big Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_FLOAT_LE</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_FLOAT_LE</span></tt></td>
|
||||
<td>32 bit samples encoded as float (Little Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_FLOAT_BE</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_FLOAT_BE</span></tt></td>
|
||||
<td>32 bit samples encoded as float (Big Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_FLOAT64_LE</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_FLOAT64_LE</span></tt></td>
|
||||
<td>64 bit samples encoded as float (Little Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_FLOAT64_BE</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_FLOAT64_BE</span></tt></td>
|
||||
<td>64 bit samples encoded as float (Big Endian byte order)</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_MU_LAW</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_MU_LAW</span></tt></td>
|
||||
<td>A logarithmic encoding (used by Sun .au files and telephony)</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_A_LAW</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_A_LAW</span></tt></td>
|
||||
<td>Another logarithmic encoding</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_IMA_ADPCM</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_IMA_ADPCM</span></tt></td>
|
||||
<td>A 4:1 compressed format defined by the Interactive Multimedia Association.</td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td>PCM_FORMAT_MPEG</td>
|
||||
<tr class="row-odd"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_MPEG</span></tt></td>
|
||||
<td>MPEG encoded audio?</td>
|
||||
</tr>
|
||||
<tr class="row-even"><td>PCM_FORMAT_GSM</td>
|
||||
<tr class="row-even"><td><tt class="docutils literal"><span class="pre">PCM_FORMAT_GSM</span></tt></td>
|
||||
<td>9600 bits/s constant rate encoding for speech</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -253,19 +291,19 @@ interpret data for playback, and how data is encoded in captures.</p>
|
||||
<tt class="descclassname">PCM.</tt><tt class="descname">setperiodsize</tt><big>(</big><em>period</em><big>)</big><a class="headerlink" href="#alsaaudio.PCM.setperiodsize" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Sets the actual period size in frames. Each write should consist of
|
||||
exactly this number of frames, and each read will return this
|
||||
number of frames (unless the device is in <tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, in
|
||||
number of frames (unless the device is in <tt class="xref py py-const docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, in
|
||||
which case it may return nothing at all)</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="alsaaudio.PCM.read">
|
||||
<tt class="descclassname">PCM.</tt><tt class="descname">read</tt><big>(</big><big>)</big><a class="headerlink" href="#alsaaudio.PCM.read" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>In <tt class="docutils literal"><span class="pre">PCM_NORMAL</span></tt> mode, this function blocks until a full period is
|
||||
<dd><p>In <tt class="xref py py-const docutils literal"><span class="pre">PCM_NORMAL</span></tt> mode, this function blocks until a full period is
|
||||
available, and then returns a tuple (length,data) where <em>length</em> is
|
||||
the number of frames of captured data, and <em>data</em> is the captured
|
||||
sound frames as a string. The length of the returned data will be
|
||||
periodsize*framesize bytes.</p>
|
||||
<p>In <tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, the call will not block, but will return
|
||||
<p>In <tt class="xref py py-const docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, the call will not block, but will return
|
||||
<tt class="docutils literal"><span class="pre">(0,'')</span></tt> if no new period has become available since the last
|
||||
call to read.</p>
|
||||
</dd></dl>
|
||||
@@ -277,20 +315,20 @@ call to read.</p>
|
||||
multiple of the frame size, and <em>should</em> be exactly the size of a
|
||||
period. If less than ‘period size’ frames are provided, the actual
|
||||
playout will not happen until more data is written.</p>
|
||||
<p>If the device is not in <tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, this call will block if
|
||||
<p>If the device is not in <tt class="xref py py-const docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, this call will block if
|
||||
the kernel buffer is full, and until enough sound has been played
|
||||
to allow the sound data to be buffered. The call always returns the
|
||||
size of the data provided.</p>
|
||||
<p>In <tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, the call will return immediately, with a
|
||||
<p>In <tt class="xref py py-const docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode, the call will return immediately, with a
|
||||
return value of zero, if the buffer is full. In this case, the data
|
||||
should be written at a later time.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
<dt id="alsaaudio.PCM.pause">
|
||||
<tt class="descclassname">PCM.</tt><tt class="descname">pause</tt><big>(</big><span class="optional">[</span><em>enable=1</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#alsaaudio.PCM.pause" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>If <em>enable</em> is 1, playback or capture is paused. If <em>enable</em> is 0,
|
||||
playback/capture is resumed.</p>
|
||||
<tt class="descclassname">PCM.</tt><tt class="descname">pause</tt><big>(</big><span class="optional">[</span><em>enable=True</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#alsaaudio.PCM.pause" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>If <em>enable</em> is <tt class="xref py py-const docutils literal"><span class="pre">True</span></tt>, playback or capture is paused.
|
||||
Otherwise, playback/capture is resumed.</p>
|
||||
</dd></dl>
|
||||
|
||||
<p><strong>A few hints on using PCM devices for playback</strong></p>
|
||||
@@ -299,9 +337,9 @@ to PCM devices must <em>exactly</em> match the data rate of the device.</p>
|
||||
<p>If too little data is written to the device, it will underrun, and
|
||||
ugly clicking sounds will occur. Conversely, of too much data is
|
||||
written to the device, the write function will either block
|
||||
(<tt class="docutils literal"><span class="pre">PCM_NORMAL</span></tt> mode) or return zero (<tt class="docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode).</p>
|
||||
(<tt class="xref py py-const docutils literal"><span class="pre">PCM_NORMAL</span></tt> mode) or return zero (<tt class="xref py py-const docutils literal"><span class="pre">PCM_NONBLOCK</span></tt> mode).</p>
|
||||
<p>If your program does nothing but play sound, the best strategy is to put the
|
||||
device in <tt class="docutils literal"><span class="pre">PCM_NORMAL</span></tt> mode, and just write as much data to the device as
|
||||
device in <tt class="xref py py-const docutils literal"><span class="pre">PCM_NORMAL</span></tt> mode, and just write as much data to the device as
|
||||
possible. This strategy can also be achieved by using a separate
|
||||
thread with the sole task of playing out sound.</p>
|
||||
<p>In GUI programs, however, it may be a better strategy to setup the device,
|
||||
@@ -316,22 +354,31 @@ accumulate to quite a lot after a few seconds. Hint: use time.time()
|
||||
to check how much time has really passed, and add extra writes as nessecary.</p>
|
||||
</div>
|
||||
<div class="section" id="mixer-objects">
|
||||
<span id="id3"></span><h2>Mixer Objects<a class="headerlink" href="#mixer-objects" title="Permalink to this headline">¶</a></h2>
|
||||
<span id="id2"></span><h2>Mixer Objects<a class="headerlink" href="#mixer-objects" title="Permalink to this headline">¶</a></h2>
|
||||
<p>Mixer objects provides access to the ALSA mixer API.</p>
|
||||
<dl class="class">
|
||||
<dt>
|
||||
<em class="property">class </em><tt class="descclassname">alsaaudio.</tt><tt class="descname">Mixer</tt><big>(</big><em>control='Master'</em>, <em>id=0</em>, <em>cardindex=0</em><big>)</big></dt>
|
||||
<dd><p><em>control</em> - specifies which control to manipulate using this mixer
|
||||
<dt id="alsaaudio.Mixer">
|
||||
<em class="property">class </em><tt class="descclassname">alsaaudio.</tt><tt class="descname">Mixer</tt><big>(</big><em>control='Master'</em>, <em>id=0</em>, <em>cardindex=-1</em>, <em>device='default'</em><big>)</big><a class="headerlink" href="#alsaaudio.Mixer" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Arguments are:</p>
|
||||
<ul class="simple">
|
||||
<li><em>control</em> - specifies which control to manipulate using this mixer
|
||||
object. The list of available controls can be found with the
|
||||
<a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><tt class="xref py py-mod docutils literal"><span class="pre">alsaaudio</span></tt></a>.<a class="reference internal" href="#alsaaudio.mixers" title="alsaaudio.mixers"><tt class="xref py py-func docutils literal"><span class="pre">mixers()</span></tt></a> function. The default value is
|
||||
‘Master’ - other common controls include ‘Master Mono’, ‘PCM’, ‘Line’, etc.</p>
|
||||
<p><em>id</em> - the id of the mixer control. Default is 0</p>
|
||||
<p><em>cardindex</em> - specifies which card should be used <a class="footnote-reference" href="#f3" id="id4">[3]</a>. 0 is the
|
||||
first sound card.</p>
|
||||
<p><strong>Note:</strong> For a list of available controls, you can also use <strong>amixer</strong>:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="n">amixer</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<tt class="docutils literal"><span class="pre">'Master'</span></tt> - other common controls may be <tt class="docutils literal"><span class="pre">'Master</span> <span class="pre">Mono'</span></tt>, <tt class="docutils literal"><span class="pre">'PCM'</span></tt>,
|
||||
<tt class="docutils literal"><span class="pre">'Line'</span></tt>, etc.</li>
|
||||
<li><em>id</em> - the id of the mixer control. Default is <tt class="docutils literal"><span class="pre">0</span></tt>.</li>
|
||||
<li><em>cardindex</em> - specifies which card should be used. If this argument
|
||||
is given, the device name is constructed like this: ‘hw:<em>cardindex</em>‘ and
|
||||
the <cite>device</cite> keyword argument is ignored. <tt class="docutils literal"><span class="pre">0</span></tt> is the
|
||||
first sound card.</li>
|
||||
<li><em>device</em> - the name of the device on which the mixer resides. The default
|
||||
value is <tt class="docutils literal"><span class="pre">'default'</span></tt>.</li>
|
||||
</ul>
|
||||
<p><em>Changed in 0.8</em>:</p>
|
||||
<ul class="simple">
|
||||
<li>The keyword argument <cite>device</cite> is new and can be used to select virtual
|
||||
devices.</li>
|
||||
</ul>
|
||||
</dd></dl>
|
||||
|
||||
<p>Mixer objects have the following methods:</p>
|
||||
@@ -345,7 +392,7 @@ first sound card.</p>
|
||||
<dt id="alsaaudio.Mixer.mixer">
|
||||
<tt class="descclassname">Mixer.</tt><tt class="descname">mixer</tt><big>(</big><big>)</big><a class="headerlink" href="#alsaaudio.Mixer.mixer" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Return the name of the specific mixer controlled by this object, For example
|
||||
‘Master’ or ‘PCM’</p>
|
||||
<tt class="docutils literal"><span class="pre">'Master'</span></tt> or <tt class="docutils literal"><span class="pre">'PCM'</span></tt></p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
@@ -443,11 +490,12 @@ items available.</p>
|
||||
<p>Returns a tuple <em>(string, list of strings)</em>.</p>
|
||||
<p>For example, my soundcard has a Mixer called <em>Mono Output Select</em>. Using
|
||||
<em>amixer</em>, I get:</p>
|
||||
<div class="highlight-python"><pre>$ amixer get "Mono Output Select"
|
||||
Simple mixer control 'Mono Output Select',0
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ amixer get "Mono Output Select"
|
||||
Simple mixer control 'Mono Output Select',0
|
||||
Capabilities: enum
|
||||
Items: 'Mix' 'Mic'
|
||||
Item0: 'Mix'</pre>
|
||||
Items: 'Mix' 'Mic'
|
||||
Item0: 'Mix'
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Using <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><tt class="xref py py-mod docutils literal"><span class="pre">alsaaudio</span></tt></a>, one could do:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">alsaaudio</span>
|
||||
@@ -472,10 +520,10 @@ channel. 0 means not muted, 1 means muted.</p>
|
||||
<dt id="alsaaudio.Mixer.getrange">
|
||||
<tt class="descclassname">Mixer.</tt><tt class="descname">getrange</tt><big>(</big><span class="optional">[</span><em>direction</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#alsaaudio.Mixer.getrange" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Return the volume range of the ALSA mixer controlled by this object.</p>
|
||||
<p>The optional <em>direction</em> argument can be either ‘playback’ or
|
||||
‘capture’, which is relevant if the mixer can control both playback
|
||||
and capture volume. The default value is ‘playback’ if the mixer
|
||||
has this capability, otherwise ‘capture’</p>
|
||||
<p>The optional <em>direction</em> argument can be either <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt> or
|
||||
<tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt>, which is relevant if the mixer can control both
|
||||
playback and capture volume. The default value is <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt>
|
||||
if the mixer has playback channels, otherwise it is <tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
@@ -491,10 +539,10 @@ means not recording, 1 means recording.</p>
|
||||
<tt class="descclassname">Mixer.</tt><tt class="descname">getvolume</tt><big>(</big><span class="optional">[</span><em>direction</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#alsaaudio.Mixer.getvolume" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a list with the current volume settings for each channel. The list
|
||||
elements are integer percentages.</p>
|
||||
<p>The optional <em>direction</em> argument can be either ‘playback’ or
|
||||
‘capture’, which is relevant if the mixer can control both playback
|
||||
and capture volume. The default value is ‘playback’ if the mixer
|
||||
has this capability, otherwise ‘capture’</p>
|
||||
<p>The optional <em>direction</em> argument can be either <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt> or
|
||||
<tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt>, which is relevant if the mixer can control both
|
||||
playback and capture volume. The default value is <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt>
|
||||
if the mixer has playback channels, otherwise it is <tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
@@ -505,10 +553,10 @@ controls the new volume setting as an integer percentage.</p>
|
||||
<p>If the optional argument <em>channel</em> is present, the volume is set
|
||||
only for this channel. This assumes that the mixer can control the
|
||||
volume for the channels independently.</p>
|
||||
<p>The optional <em>direction</em> argument can be either ‘playback’ or ‘capture’ is
|
||||
relevant if the mixer has independent playback and capture volume
|
||||
capabilities, and controls which of the volumes if changed. The
|
||||
default is ‘playback’ if the mixer has this capability, otherwise ‘capture’.</p>
|
||||
<p>The optional <em>direction</em> argument can be either <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt> or
|
||||
<tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt>, which is relevant if the mixer can control both
|
||||
playback and capture volume. The default value is <tt class="xref py py-const docutils literal"><span class="pre">PCM_PLAYBACK</span></tt>
|
||||
if the mixer has playback channels, otherwise it is <tt class="xref py py-const docutils literal"><span class="pre">PCM_CAPTURE</span></tt>.</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="method">
|
||||
@@ -542,7 +590,7 @@ wait for changes on the mixer with <em>select.poll</em>.</p>
|
||||
<p>The ALSA mixer API is extremely complicated - and hardly documented at all.
|
||||
<a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><tt class="xref py py-mod docutils literal"><span class="pre">alsaaudio</span></tt></a> implements a much simplified way to access this API. In
|
||||
designing the API I’ve had to make some choices which may limit what can and
|
||||
cannot be controlled through the API. However, If I had chosen to implement the
|
||||
cannot be controlled through the API. However, if I had chosen to implement the
|
||||
full API, I would have reexposed the horrible complexity/documentation ratio of
|
||||
the underlying API. At least the <a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><tt class="xref py py-mod docutils literal"><span class="pre">alsaaudio</span></tt></a> API is easy to
|
||||
understand and use.</p>
|
||||
@@ -568,21 +616,24 @@ painful trial and error process.</p>
|
||||
<p>All examples (except mixertest.py) accept the commandline option
|
||||
<em>-c <cardname></em>.</p>
|
||||
<p>To determine a valid card name, use the commandline ALSA player:</p>
|
||||
<div class="highlight-python"><pre>$ aplay -L</pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ aplay -L
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>or:</p>
|
||||
<div class="highlight-python"><pre>$ python
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ python
|
||||
|
||||
>>> import alsaaudio
|
||||
>>> alsaaudio.cards()</pre>
|
||||
>>> alsaaudio.pcms()
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>mixertest.py accepts the commandline option <em>-c <cardindex></em>. Card
|
||||
indices start at 0.</p>
|
||||
<p>mixertest.py accepts the commandline options <em>-d <device></em> and
|
||||
<em>-c <cardindex></em>.</p>
|
||||
<div class="section" id="playwav-py">
|
||||
<h3>playwav.py<a class="headerlink" href="#playwav-py" title="Permalink to this headline">¶</a></h3>
|
||||
<p><strong>playwav.py</strong> plays a wav file.</p>
|
||||
<p>To test PCM playback (on your default soundcard), run:</p>
|
||||
<div class="highlight-python"><pre>$ python playwav.py <wav file></pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ python playwav.py <wav file>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="recordtest-py-and-playbacktest-py">
|
||||
@@ -590,69 +641,73 @@ indices start at 0.</p>
|
||||
<p><strong>recordtest.py</strong> and <strong>playbacktest.py</strong> will record and play a raw
|
||||
sound file in CD quality.</p>
|
||||
<p>To test PCM recordings (on your default soundcard), run:</p>
|
||||
<div class="highlight-python"><pre>$ python recordtest.py <filename></pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ python recordtest.py <filename>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Speak into the microphone, and interrupt the recording at any time
|
||||
with <tt class="docutils literal"><span class="pre">Ctl-C</span></tt>.</p>
|
||||
<p>Play back the recording with:</p>
|
||||
<div class="highlight-python"><pre>$ python playbacktest.py <filename></pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ python playbacktest.py <filename>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section" id="mixertest-py">
|
||||
<h3>mixertest.py<a class="headerlink" href="#mixertest-py" title="Permalink to this headline">¶</a></h3>
|
||||
<p>Without arguments, <strong>mixertest.py</strong> will list all available <em>controls</em>.
|
||||
The output might look like this:</p>
|
||||
<div class="highlight-python"><pre>$ ./mixertest.py
|
||||
<p>Without arguments, <strong>mixertest.py</strong> will list all available <em>controls</em> on the
|
||||
default soundcard.</p>
|
||||
<p>The output might look like this:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ ./mixertest.py
|
||||
Available mixer controls:
|
||||
'Master'
|
||||
'Master Mono'
|
||||
'Headphone'
|
||||
'PCM'
|
||||
'Line'
|
||||
'Line In->Rear Out'
|
||||
'CD'
|
||||
'Mic'
|
||||
'PC Speaker'
|
||||
'Aux'
|
||||
'Mono Output Select'
|
||||
'Capture'
|
||||
'Mix'
|
||||
'Mix Mono'</pre>
|
||||
'Master'
|
||||
'Master Mono'
|
||||
'Headphone'
|
||||
'PCM'
|
||||
'Line'
|
||||
'Line In->Rear Out'
|
||||
'CD'
|
||||
'Mic'
|
||||
'PC Speaker'
|
||||
'Aux'
|
||||
'Mono Output Select'
|
||||
'Capture'
|
||||
'Mix'
|
||||
'Mix Mono'
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>With a single argument - the <em>control</em>, it will display the settings of
|
||||
that control; for example:</p>
|
||||
<div class="highlight-python"><pre>$ ./mixertest.py Master
|
||||
Mixer name: 'Master'
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ ./mixertest.py Master
|
||||
Mixer name: 'Master'
|
||||
Capabilities: Playback Volume Playback Mute
|
||||
Channel 0 volume: 61%
|
||||
Channel 1 volume: 61%</pre>
|
||||
Channel 1 volume: 61%
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>With two arguments, the <em>control</em> and a <em>parameter</em>, it will set the
|
||||
parameter on the mixer:</p>
|
||||
<div class="highlight-python"><pre>$ ./mixertest.py Master mute</pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ ./mixertest.py Master mute
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This will mute the Master mixer.</p>
|
||||
<p>Or:</p>
|
||||
<div class="highlight-python"><pre>$ ./mixertest.py Master 40</pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ ./mixertest.py Master 40
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This sets the volume to 40% on all channels.</p>
|
||||
<p>To select a different soundcard, use either the <em>device</em> or <em>cardindex</em>
|
||||
argument:</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ ./mixertest.py -c 0 Master
|
||||
Mixer name: 'Master'
|
||||
Capabilities: Playback Volume Playback Mute
|
||||
Channel 0 volume: 61%
|
||||
Channel 1 volume: 61%
|
||||
</pre></div>
|
||||
</div>
|
||||
<p class="rubric">Footnotes</p>
|
||||
<table class="docutils footnote" frame="void" id="f1" rules="none">
|
||||
<colgroup><col class="label" /><col /></colgroup>
|
||||
<tbody valign="top">
|
||||
<tr><td class="label"><a class="fn-backref" href="#id2">[1]</a></td><td>ALSA also allows <tt class="docutils literal"><span class="pre">PCM_ASYNC</span></tt>, but this is not supported yet.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="docutils footnote" frame="void" id="f2" rules="none">
|
||||
<colgroup><col class="label" /><col /></colgroup>
|
||||
<tbody valign="top">
|
||||
<tr><td class="label">[2]</td><td><a class="reference internal" href="#module-alsaaudio" title="alsaaudio (Linux)"><tt class="xref py py-mod docutils literal"><span class="pre">alsaaudio</span></tt></a> will leave any name alone that has a ‘:’ (colon) in it.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="docutils footnote" frame="void" id="f3" rules="none">
|
||||
<colgroup><col class="label" /><col /></colgroup>
|
||||
<tbody valign="top">
|
||||
<tr><td class="label"><a class="fn-backref" href="#id4">[3]</a></td><td>This is inconsistent with the PCM objects, which use names, but it is consistent with aplay and amixer.</td></tr>
|
||||
<tr><td class="label">[1]</td><td>ALSA also allows <tt class="docutils literal"><span class="pre">PCM_ASYNC</span></tt>, but this is not supported yet.</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@@ -722,8 +777,8 @@ parameter on the mixer:</p>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2008-2009, Casper Wilstrup, Lars Immisch.
|
||||
Last updated on Apr 30, 2015.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
Last updated on May 13, 2015.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
Binary file not shown.
+3
-5
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -15,7 +13,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
URL_ROOT: './',
|
||||
VERSION: '0.8',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
@@ -108,8 +106,8 @@
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2008-2009, Casper Wilstrup, Lars Immisch.
|
||||
Last updated on Apr 30, 2015.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
Last updated on May 13, 2015.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+14
-12
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -15,7 +13,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
URL_ROOT: './',
|
||||
VERSION: '0.8',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
@@ -60,9 +58,9 @@
|
||||
<col class="field-name" />
|
||||
<col class="field-body" />
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Author:</th><td class="field-body">Casper Wilstrup</td>
|
||||
<tr class="field-odd field"><th class="field-name">Author:</th><td class="field-body">Casper Wilstrup <<a class="reference external" href="mailto:cwi%40aves.dk">cwi<span>@</span>aves<span>.</span>dk</a>></td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Author:</th><td class="field-body">Lars Immisch</td>
|
||||
<tr class="field-even field"><th class="field-name">Author:</th><td class="field-body">Lars Immisch <<a class="reference external" href="mailto:lars%40ibp.de">lars<span>@</span>ibp<span>.</span>de</a>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -123,7 +121,8 @@ default in Linux kernel 2.6 and later. If you are using kernel version 2.4 you
|
||||
may need to install the ALSA patches yourself - although most distributions
|
||||
ship with ALSA kernels.</p>
|
||||
<p>To install, execute the following: —</p>
|
||||
<div class="highlight-python"><pre>$ python setup.py build</pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ python setup.py build
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>And then as root: —</p>
|
||||
<div class="highlight-python"><div class="highlight"><pre><span class="c"># python setup.py install</span>
|
||||
@@ -133,18 +132,21 @@ ship with ALSA kernels.</p>
|
||||
<div class="section" id="testing">
|
||||
<h1>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h1>
|
||||
<p>First of all, run:</p>
|
||||
<div class="highlight-python"><pre>$ python test.py</pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ python test.py
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This is a small test suite that mostly performs consistency tests. If
|
||||
it fails, please file a <a class="reference external" href="http://sourceforge.net/tracker/?group_id=120651">bug report</a>.</p>
|
||||
it fails, please file a <a class="reference external" href="https://github.com/larsimmisch/pyalsaaudio/issues">bug report</a>.</p>
|
||||
<p>To test PCM recordings (on your default soundcard), verify your
|
||||
microphone works, then do:</p>
|
||||
<div class="highlight-python"><pre>$ python recordtest.py <filename></pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ python recordtest.py <filename>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Speak into the microphone, and interrupt the recording at any time
|
||||
with <tt class="docutils literal"><span class="pre">Ctl-C</span></tt>.</p>
|
||||
<p>Play back the recording with:</p>
|
||||
<div class="highlight-python"><pre>$ python playbacktest.py <filename></pre>
|
||||
<div class="highlight-python"><div class="highlight"><pre>$ python playbacktest.py <filename>
|
||||
</pre></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -213,8 +215,8 @@ with <tt class="docutils literal"><span class="pre">Ctl-C</span></tt>.</p>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2008-2009, Casper Wilstrup, Lars Immisch.
|
||||
Last updated on Apr 30, 2015.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
Last updated on May 13, 2015.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+5
-5
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -15,7 +13,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
URL_ROOT: './',
|
||||
VERSION: '0.8',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
@@ -30,6 +28,8 @@
|
||||
<script type="text/javascript">
|
||||
jQuery(function() { Search.loadIndex("searchindex.js"); });
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" id="searchindexloader"></script>
|
||||
|
||||
|
||||
</head>
|
||||
@@ -99,8 +99,8 @@
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2008-2009, Casper Wilstrup, Lars Immisch.
|
||||
Last updated on Apr 30, 2015.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
Last updated on May 13, 2015.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-6
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
|
||||
@@ -15,7 +13,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var DOCUMENTATION_OPTIONS = {
|
||||
URL_ROOT: '',
|
||||
URL_ROOT: './',
|
||||
VERSION: '0.8',
|
||||
COLLAPSE_INDEX: false,
|
||||
FILE_SUFFIX: '.html',
|
||||
@@ -136,7 +134,7 @@ on.</p>
|
||||
title="previous chapter">Introduction</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="libalsaaudio.html"
|
||||
title="next chapter"><tt class="docutils literal docutils literal"><span class="pre">alsaaudio</span></tt></a></p>
|
||||
title="next chapter"><tt class="docutils literal"><span class="pre">alsaaudio</span></tt></a></p>
|
||||
<h3>This Page</h3>
|
||||
<ul class="this-page-menu">
|
||||
<li><a href="_sources/terminology.txt"
|
||||
@@ -179,8 +177,8 @@ on.</p>
|
||||
</div>
|
||||
<div class="footer">
|
||||
© Copyright 2008-2009, Casper Wilstrup, Lars Immisch.
|
||||
Last updated on Apr 30, 2015.
|
||||
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
|
||||
Last updated on May 13, 2015.
|
||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user