sample/vs_android.cc
/**
 * @see the C method dataCallback at the top of this file
 */
@see the C method dataCallback at the top of this file
@see the C method dataCallback at the top of this file
int32_t VsAndroidCapture::readFromRecorder(int16_t *audioData, int32_t numFrames) {
     aaudio_result_t frameCount = 0;
     int32_t inc = 0;
     while (numFrames > 0) {	   
     	frameCount = AAudioStream_read(recordingStream_,
		       	&audioData[inc] , 
			numFrames,
			static_cast<int64_t>(128*1000*1000));
     	if (frameCount < 0) {
	 	LOGE("****AAudioStream_read() returns %s",
			     AAudio_convertResultToText(frameCount));
		frameCount = 0;   continue to play silent audio
		return -1;
     	}
     	numFrames -= frameCount;
	inc += frameCount;
	printf("%lu readen, numFrames left %lu\n", frameCount, numFrames);
     } 
     return 2048;
}
int32_t VsAndroidCapture :: readFromRecorder ( int16_t * audioData , int32_t numFrames ) { aaudio_result_t frameCount = 0 ; int32_t inc = 0 ; while ( numFrames > 0 ) { frameCount = AAudioStream_read ( recordingStream_ , & audioData [ inc ] , numFrames , static_cast < int64_t > ( 128 * 1000 * 1000 ) ) ; if ( frameCount < 0 ) { LOGE ( " " , AAudio_convertResultToText ( frameCount ) ) ; frameCount = 0 ; return -1 ; } numFrames -= frameCount ; inc += frameCount ; } return 2048 ; }
@see the C method dataCallback at the top of this file
@see the C method dataCallback at the top of this file
// frameCount could be //     //    < 0 : error code //         //    >= 0 : actual value read from stream // // continue to play silent audio //printf("%lu readen, numFrames left %lu\n", frameCount, numFrames);