pa_active=1; 
pa_active = 1; 
static int open_output(void){	double rate;	int n, nrates;	PaSampleFormat SampleFormat,nativeSampleFormats;		if(pa_active==0){		err = Pa_Initialize();		if( err != paNoError ) goto error;		pa_active=1;	}	if(first==1){		atexit(close_output);		first=0;	}	DeviceID=Pa_GetDefaultOutputDeviceID();	DeviceInfo=Pa_GetDeviceInfo( DeviceID);		nativeSampleFormats=DeviceInfo->nativeSampleFormats;	SampleFormat=paInt8;	if(dpm.encoding & PE_16BIT){		if(nativeSampleFormats & paInt16){ 			SampleFormat=paInt16;		}else{			SampleFormat=paInt8;			dpm.encoding &= ~((int32)PE_16BIT);		}	}	if(dpm.encoding & PE_24BIT){		if(nativeSampleFormats & paInt24){			SampleFormat=paInt24;		}else{			dpm.encoding &= ~((int32)PE_24BIT);			if(nativeSampleFormats & paInt16){				SampleFormat=paInt16;				dpm.encoding |= ((int32)PE_16BIT);			}else{				SampleFormat=paInt8;			}		}	}	dpm.encoding = dpm.encoding  & ~((int32)PE_ULAW) & ~((int32)PE_ALAW) & ~((int32)PE_BYTESWAP);	dpm.encoding = dpm.encoding|PE_SIGNED;	stereo=(dpm.encoding & PE_MONO)?1:2;	data_nbyte=(dpm.encoding & PE_16BIT)?2:1;	data_nbyte=(dpm.encoding & PE_24BIT)?3:data_nbyte;	nrates=DeviceInfo->numSampleRates;	if(nrates!=-1){		rate=DeviceInfo->sampleRates[nrates-1];		for(n=nrates-1;n>=0;n--){			if(dpm.rate <= DeviceInfo->sampleRates[n]) rate=DeviceInfo->sampleRates[n];		}	}else{		rate=dpm.rate;		if(dpm.rate < DeviceInfo->sampleRates[0]) rate=DeviceInfo->sampleRates[0];		if(dpm.rate > DeviceInfo->sampleRates[1]) rate=DeviceInfo->sampleRates[1];	}	dpm.rate=(int32)rate;		pa_data.samplesToGo=0;	pa_data.bufpoint=pa_data.buf;	pa_data.bufepoint=pa_data.buf;//	firsttime=1;	numBuffers=Pa_GetMinNumBuffers( framesPerBuffer, dpm.rate );	framesPerInBuffer=numBuffers*framesPerBuffer;	if(framesPerInBuffer<4096) framesPerInBuffer=4096;	bytesPerInBuffer=framesPerInBuffer*data_nbyte*stereo;//	printf("%d\n",framesPerInBuffer);//	printf("%d\n",dpm.rate);	err = Pa_OpenDefaultStream(    	&stream,        /* passes back stream pointer */    	0,              /* no input channels */    	stereo,              /* 2:stereo 1:mono output */    	SampleFormat,      /* 24bit 16bit 8bit output */		(double)dpm.rate,          /* sample rate */    	framesPerBuffer,            /* frames per buffer */    	numBuffers,              /* number of buffers, if zero then use default minimum */    	paCallback, /* specify our custom callback */    	&pa_data);   /* pass our data through to callback */	if( err != paNoError ) goto error;	return 0;error:	Pa_Terminate(); pa_active=0;	ctl->cmsg(  CMSG_ERROR, VERB_NORMAL, "PortAudio error: %s\n", Pa_GetErrorText( err ) );	return -1;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/688d97ddab7ae22f043b9e1d63719528e50d86ce/portaudio_a.c/clean/timidity/portaudio_a.c