Soundpool sample not ready

Posted by SteD on Stack Overflow See other posts from Stack Overflow or by SteD
Published on 2011-03-05T08:00:31Z Indexed on 2012/03/24 11:29 UTC
Read the original article Hit count: 225

Filed under:
|

I have a .wav file that I'd like to use across my game, currently I am loading the sound in onCreate() of each activity in the game.

 soundCount = soundpool.load(this,R.raw.count, 1);

The sound will be played once the activity starts.

  soundpool.play(soundCount, 0.9f, 0.9f, 1, -1, 1f);

Problem is at times I will hit the error "sample x not ready". Is it possible to load the .wav file once upon starting the game and keep it in memory and use it later across the game? Or is it possible to wait for 1-2 seconds for the sound to load finish?

© Stack Overflow or respective owner

Related posts about android

Related posts about soundpool