#NEWLINE# def _get_stream_parameters( kind , device , channels , dtype , latency , samplerate ) : #NEWLINE# #INDENT# 'Generate PaStreamParameters struct.' #NEWLINE# if ( device is None ) : #NEWLINE# #INDENT# if ( kind == 'input' ) : #NEWLINE# #INDENT# device = _pa . Pa_GetDefaultInputDevice ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( kind == 'output' ) : #NEWLINE# #INDENT# device = _pa . Pa_GetDefaultOutputDevice ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# info = device_info ( device ) #NEWLINE# if ( channels is None ) : #NEWLINE# #INDENT# channels = info [ ( ( 'max_' + kind ) + '_channels' ) ] #NEWLINE# #UNINDENT# dtype = np . dtype ( dtype ) #NEWLINE# try : #NEWLINE# #INDENT# sample_format = _np2pa [ dtype ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# raise ValueError ( ( ( 'Invalid ' + kind ) + ' sample format' ) ) #NEWLINE# #UNINDENT# if ( samplerate is None ) : #NEWLINE# #INDENT# samplerate = info [ 'default_samplerate' ] #NEWLINE# #UNINDENT# parameters = ffi . new ( 'PaStreamParameters*' , ( device , channels , sample_format , latency , ffi . NULL ) ) #NEWLINE# return ( parameters , dtype , samplerate )