AlsaDevices
index
/home/david/Projects/Jokosher/trunk/Jokosher/AlsaDevices.py

#               THIS FILE IS PART OF THE JOKOSHER PROJECT AND LICENSED UNDER THE GPL. SEE
#               THE 'COPYING' FILE FOR DETAILS
#
#               AlsaDevices.py
#
#               This file offers ALSA specific helper functions.
#
#-------------------------------------------------------------------------------

 
Modules
       
Globals
dbus
gst

 
Functions
       
GetAlsaList(type)
Returns a dictionary containing ALSA device names and their 
correspoding ALSA id's (i.e. hw:0).
 
Parameters:
        type -- string specifying the type of ALSA device needed:
                        "playback"
                        "capture"
 
Returns:
        a list containing all the matching devices found.
GetChannelsOffered(device)
Checks for the number of available channels on a device.
 
Parameters:
        device -- ALSA device (e.g. hw:0) to poll for available channels.
        
Returns:
        the number of channels available on a device.
GetGstElementSampleRate(elementName, padName, **properties)
Checks for available sample rates for the given GStreamer element.
 
Parameters:
        elementName -- the name of the gstreamer element (ie "alsasrc").
        padName -- the name of the pad to query ("src" or "sink").
        properties -- and properties to set on the element.
        
Returns:
        any of the following depending on the gstreamer element:
        1) an int representing the only supported sample rate.
        2) an IntRange class with IntRange.low and IntRange.high being the min and max sample rates.
        3) a list of ints representing all the supported sample rates.
GetRecordingMixers(device)
Looks for channels enabled for recording.
 
Parameters:
        device -- ALSA device (i.e. hw:0) to poll for values.
        
Returns:
        a list containing all the channels which have recording enabled.
GetRecordingSampleRate(device='hw:0')
Checks for available recording sample rates.
 
Parameters:
        device -- ALSA device to poll for values. "hw:0" by default.
 
Returns:
        any of the following depending on the sound card:
        1) an int representing the only supported sample rate.
        2) an IntRange class with IntRange.low and IntRange.high being the min and max sample rates.
        3) a list of ints representing all the supported sample rates.