Code example for AudioTrack

Methods: getPlaybackHeadPosition

0
		} 
	} 
 
	public static boolean isPlaying() 
	{ 
		try{return audiotrk.getPlaybackHeadPosition() < (generatedSnd.length);}catch(Exception e){return false;}
	} 
 
 
	private static int minbufsize;
	private static int length;
 
	private static void playSound(){ 
		if (audiotrk != null)
		{ 
			if (generatedSnd != null)
			{ 
				while (audiotrk.getPlaybackHeadPosition() < (generatedSnd.length))
					SystemClock.sleep(50);  // let existing sample finish first: this can probably be set to a smarter number using the information above
			} 
			audiotrk.release();