I have an arrayList containing resource ID's of different sounds and I need to iterate through and play all of the sound. The code I have now is not playing any of the sounds and I'm not sure why.
for(DataClass dc : loopHolder){
resID = dc.getResID();
timeSincePrevious = dc.getTimeSincePrevious();
spLoop.load(getActivity(), dc.getResID(), 0);
spLoop.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
@Override
public void onLoadComplete(SoundPool soundPool, int mySoundId, int status) {
loaded = true;
}
});
if(loaded){
spLoop.play(resID, 1, 1, 0, 0, 1);
LoopTimer timer = new LoopTimer(timeSincePrevious, 1000);
timer.start();
}
loaded = false;
}
Aucun commentaire:
Enregistrer un commentaire