Hi,

I am trying to write a mixer program using the ossaudiodev module.
I could hardly find any documentation or example code, so I try and ask
here.
There are two things that seem to work already, however I am not sure
if the solutions I found are the way it is supposed to be.

First, when on initialization of my MixerController class I query the
properties of the mixer device in use, I tried the following:

        self._mixer = ossaudiodev.openmixer()
        self.names, self.controls, self.stereocontrols,
self.reccontrols = [], [], [], []
        clabels = ossaudiodev.control_labels
        for label in clabels:
            control = clabels.index(label)
            if self._mixer.controls() & (1 << control):
                # channel is available
                self.names.append(label.strip())
                self.controls.append(control)
                # now see if it's a stereo channel
                if self._mixer.stereocontrols() & (1 << control):
                    self.stereocontrols.append(control)
                # finally see if it is an input device
                if self._mixer.reccontrols()  & (1 << control):
                    self.reccontrols.append(control)

This works, at least on my box, however the ossaudiodev.control_label
attribute is not mentioned in the library reference, so I am  not sure
if this is the "canonical" way  that will always work.

Second, when I want to change the currently used recording source, I am
not sure if I have to  provide different code for sound cards that
support multiple active recording source channels and sound cards that
support only one active recording source channel; the code I wrote
works with my card (which allows multiple channels being active), but I
don't have a card that supports only one active recording channel at
hand so I cannot test if the same code will work.
Finally, if it *is* neccessary to provide different code, how can I
find out which type of card is currently in use?

Any pointers are much appreciated.

Thanks in advance

Michael

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to