oss mixer usage

K

klappnase

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top