Code example for AudioTrack

Methods: getStateplaysetStereoVolumewrite

0
				AudioFormat.CHANNEL_OUT_STEREO, AudioFormat.ENCODING_PCM_16BIT,  
				10 * AudioTrack.getMinBufferSize(sampleRate, AudioFormat.CHANNEL_OUT_STEREO,  
						AudioFormat.ENCODING_PCM_16BIT), AudioTrack.MODE_STATIC); 
		//mAudioTrack.setPositionNotificationPeriod(bufferSize >> 1); 
		//mAudioTrack.setPlaybackPositionUpdateListener(mPlaybackListener);*/  
		mAudioTrack.setStereoVolume(AudioTrack.getMaxVolume(), AudioTrack.getMaxVolume());
		 
		 
		if (mAudioTrack.getState() != 3) {mAudioTrack.play();}
		 //TestSound(); 
		mAudioTrack.write(outputBuffer, writeOffset, bufferSize);
		//Log.i("OnAir",mAudioManager.isMicrophoneMute() + " " + mAudioManager.isMusicActive() 
		//		+ " " + mAudioManager.isSpeakerphoneOn() + " " + mAudioManager.getMode()); 
		 
	} 
	 
	private boolean ProcessBuffer() { 
		float[] amplitudes = new float[128];
		 
		outputBuffer = processBuffer;
		//for (int i=0; i<bufferSize>>2;i++){