#NEWLINE# def __init__( self , samplerate = None , blocksize = 0 , device = None , channels = None , dtype = 'float32' , latency = 0 , callback = None , finished_callback = None , **flags ) : #NEWLINE# #INDENT# 'Open a new stream.\n\n        If no input or output device is specified, the\n        default input/output device is taken.\n\n        If a callback is given, it will be called whenever the stream\n        is active and data is available to read or write. If a\n        finished_callback is given, it will be called whenever the\n        stream is stopped or aborted. If a callback is given, read()\n        and write() should not be used.\n\n        The callback should have a signature like this:\n\n        callback(input, output, time, status) -> flag\n\n        where input is the recorded data as a NumPy array, output is\n        another NumPy array (with uninitialized content), where the data\n        for playback has to be written to (using indexing).\n        time is a dictionary with some timing information, and\n        status indicates whether input or output buffers have\n        been inserted or dropped to overcome underflow or overflow\n        conditions.\n\n        The function must return one of continue_flag, complete_flag or\n        abort_flag.  complete_flag and abort_flag act as if stop() or\n        abort() had been called, respectively.  continue_flag resumes\n        normal audio processing.\n\n        The finished_callback should be a function with no arguments\n        and no return values.\n\n        ' #NEWLINE# ( idevice , odevice ) = _split ( device ) #NEWLINE# ( ichannels , ochannels ) = _split ( channels ) #NEWLINE# ( idtype , odtype ) = _split ( dtype ) #NEWLINE# ( ilatency , olatency ) = _split ( latency ) #NEWLINE# ( iparameters , idtype , isamplerate ) = _get_stream_parameters ( 'input' , idevice , ichannels , idtype , ilatency , samplerate ) #NEWLINE# ( oparameters , odtype , osamplerate ) = _get_stream_parameters ( 'output' , odevice , ochannels , odtype , olatency , samplerate ) #NEWLINE# self . dtype = ( idtype , odtype ) #NEWLINE# self . device = ( iparameters . device , oparameters . device ) #NEWLINE# ichannels = iparameters . channelCount #NEWLINE# ochannels = oparameters . channelCount #NEWLINE# self . channels = ( ichannels , ochannels ) #NEWLINE# if ( isamplerate != osamplerate ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Input and output device must have the same samplerate' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# samplerate = isamplerate #NEWLINE# #UNINDENT# def callback_wrapper( iptr , optr , frames , time , status , _ ) : #NEWLINE# #INDENT# idata = _frombuffer ( iptr , frames , ichannels , idtype ) #NEWLINE# odata = _frombuffer ( optr , frames , ochannels , odtype ) #NEWLINE# return callback ( idata , odata , _time2dict ( time ) , status ) #NEWLINE# #UNINDENT# _StreamBase . __init__ ( self , iparameters , oparameters , samplerate , blocksize , ( callback and callback_wrapper ) , finished_callback , ** flags )