Code example for SoundPool

Methods: sleep

0
		return totalDuration; 
	} 
 
	public void prepare() throws SoundException, InterruptedException { 
		if (soundPool != null) return;
		soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
		if (duration <= 0) {
			throw new SoundException("Inccorect duration for " + filePath);
		} 
		try { 
			soundID = sourceProvider.loadSound(soundPool, filePath);
		} catch (IOException ex) {
			throw new SoundException("Cannot load sound " +filePath + ex);
		} 
		if (soundID == 0) {
			throw new SoundException("Cannot load sound " +filePath);
		} 
 
		// give enough time to prepare the sound 
		// the load time for sound is from 20 to 200ms 
		Thread.sleep(500);
	} 
	 
	public void play() throws SoundException, InterruptedException { 
		if (soundPool == null) return;
		try {