#NEWLINE# def device_info( index = None ) : #NEWLINE# #INDENT# 'Return a generator with information about each device.\n\n    If index is given, only one dictionary for the given device is\n    returned.\n\n    ' #NEWLINE# if ( index is None ) : #NEWLINE# #INDENT# return ( device_info ( i ) for i in range ( _pa . Pa_GetDeviceCount ( ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# info = _pa . Pa_GetDeviceInfo ( index ) #NEWLINE# if ( not info ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Invalid device' ) #NEWLINE# #UNINDENT# assert ( info . structVersion == 2 ) #NEWLINE# if ( 'DirectSound' in hostapi_info ( info . hostApi ) [ 'name' ] ) : #NEWLINE# #INDENT# enc = 'mbcs' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# enc = 'utf-8' #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'name' : ffi . string ( info . name ) . decode ( encoding = enc , errors = 'ignore' ) , #NEWLINE# 'hostapi' : info . hostApi , #NEWLINE# 'max_input_channels' : info . maxInputChannels , #NEWLINE# 'max_output_channels' : info . maxOutputChannels , #NEWLINE# 'default_low_input_latency' : info . defaultLowInputLatency , #NEWLINE# 'default_low_output_latency' : info . defaultLowOutputLatency , #NEWLINE# 'default_high_input_latency' : info . defaultHighInputLatency , #NEWLINE# 'default_high_output_latency' : info . defaultHighOutputLatency , #NEWLINE# 'default_samplerate' : info . defaultSampleRate , #NEWLINE# #UNINDENT# }