Android : how to use soundpool for looping sound in android

on Tuesday, September 30, 2014


i want when my app open , play a sound and this sound repeat unlimited . i want use soundpool because mediaplayer have delay for every repeat . i use this code :



soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);
soundID = soundPool.load(getApplicationContext(), R.raw.b, 1);
soundPool.play(soundID, 1, 1, 1, -1, 1f);


but this code not play sound . in examples i want remove this code :



@Override
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
loaded = true;
}


its possible ? because i have more sound to play .


0 comments:

Post a Comment