oss mixer usage

Discussion in 'Python' started by klappnase@web.de, Jan 16, 2006.

  1. Guest

    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
     
    , Jan 16, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=

    pygame.mixer.music not playing

    =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=, Feb 6, 2005, in forum: Python
    Replies:
    12
    Views:
    2,822
    =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=
    Feb 7, 2005
  2. soorya
    Replies:
    1
    Views:
    690
    mlimber
    Oct 27, 2005
  3. Adrian

    Color mixer

    Adrian, Feb 15, 2008, in forum: HTML
    Replies:
    3
    Views:
    480
    Adrian
    Feb 15, 2008
  4. globalrev

    pygame.mixer.load not working

    globalrev, May 4, 2008, in forum: Python
    Replies:
    1
    Views:
    255
    Diez B. Roggisch
    May 4, 2008
  5. Alex
    Replies:
    1
    Views:
    1,155
    S├ębastien Ouellet
    Aug 29, 2009
Loading...

Share This Page