This method closes the open mixer device file. Any further attempts to
use the mixer after this file is closed will raise an IOError.
Returns the file handle number of the open mixer device file.
The remaining methods are specific to audio mixing:
This method returns a bitmask specifying the available mixer controls
(``Control'' being a specific mixable ``channel'', such as
SOUND_MIXER_PCM or SOUND_MIXER_SYNTH). This
bitmask indicates a subset of all available mixer controls--the
SOUND_MIXER_* constants defined at module level. To determine if,
for example, the current mixer object supports a PCM mixer, use the
following Python code:
if mixer.controls() & (1 << ossaudiodev.SOUND_MIXER_PCM):
# PCM is supported
... code ...
For most purposes, the SOUND_MIXER_VOLUME (master volume) and
SOUND_MIXER_PCM controls should suffice--but code that uses the
mixer should be flexible when it comes to choosing mixer controls. On
the Gravis Ultrasound, for example, SOUND_MIXER_VOLUME does not
Returns a bitmask indicating stereo mixer controls. If a bit is set,
the corresponding control is stereo; if it is unset, the control is
either monophonic or not supported by the mixer (use in combination with
controls() to determine which).
See the code example for the controls() function for an example
of getting data from a bitmask.
Returns a bitmask specifying the mixer controls that may be used to
record. See the code example for controls() for an example of
reading from a bitmask.
Returns the volume of a given mixer control. The returned volume is a
2-tuple (left_volume,right_volume). Volumes are specified as
numbers from 0 (silent) to 100 (full volume). If the control is
monophonic, a 2-tuple is still returned, but both volumes are
Raises OSSAudioError if an invalid control was is specified,
or IOError if an unsupported control is specified.
control, (left, right))
Sets the volume for a given mixer control to (left,right).
left and right must be ints and between 0 (silent) and 100
(full volume). On success, the new volume is returned as a 2-tuple.
Note that this may not be exactly the same as the volume specified,
because of the limited resolution of some soundcard's mixers.
Raises OSSAudioError if an invalid mixer control was
specified, or if the specified volumes were out-of-range.
This method returns a bitmask indicating which control(s) are
currently being used as a recording source.
Call this function to specify a recording source. Returns a bitmask
indicating the new recording source (or sources) if successful; raises
IOError if an invalid source was specified. To set the current
recording source to the microphone input: