Code example for AudioRecord

Methods: getChannelCountgetSampleRate

0
			mAudioRecordReleased = false;
			// »ñµÃ¹¹½¨¶ÔÏóµÄ×îС»º³åÇø´óС 
			mMinRecordBufSize = AudioRecord.getMinBufferSize(samplerate,
					channel, samplebit);
			mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.MIC,
					samplerate, channel, samplebit, mMinRecordBufSize);
 
			// ÉèÖÃAnyChatµÄÍⲿÒôƵÊäÈë²ÎÊý 
			AnyChatCoreSDK.SetInputAudioFormat(mAudioRecord.getChannelCount(),
					mAudioRecord.getSampleRate(), 16, 0);
 
			if (mRecordAudioThread == null) {
				mRecordThreadExitFlag = false;
				mRecordAudioThread = new RecordAudioThread();
				mRecordAudioThread.start();
			} 
			Log.d(TAG, "mMinRecordBufSize = " + mMinRecordBufSize);
		} catch (Exception e) {
			return -1; 
		} 
		return 0;