Code example for AudioTrack

Methods: getStaterelease

0
	} 
	 
	public void setData(short[] audioData) {
		 
		if(track != null) {
			track.release();
		} 
		 
    	final int bufSize = Math.max(sampleRateInHz, audioData.length);
    	this.audioData = new short[bufSize];
    	 
		track = new AudioTrack(AudioManager.STREAM_MUSIC, sampleRateInHz, AudioFormat.CHANNEL_CONFIGURATION_MONO, AudioFormat.ENCODING_PCM_16BIT, bufSize, AudioTrack.MODE_STATIC);
		 
		if(track.getState() == AudioTrack.STATE_NO_STATIC_DATA) {
			System.arraycopy(audioData, 0, this.audioData, 0, audioData.length);
			track.write(audioData, 0, audioData.length);
		} 
	} 
	 
	public void play() { 
Connect your IDE to all the code out there  Get Codota for Java