0

I'm working on a little game that is uses soundpool to play small sound-files. However, it now seems that I have too many sound files that I want to add to the soundpool since I get an error saying that the heap has an overflow. So then I tried to load the sound files when they are needed instead of loading them when the class instance is initialized, but the result of that turned out very bad.

Are there any other ways I can make it work using soundpool or do I have to use media player instead? I already have media player class that is used to play long sound clips like music files and so on. So the backup plan is to make two instances of the media player class that runs on two separate threads where one of them handles the small sound files. Any help and ideas is highly appreciated.

Greetings!

Araw
  • 2,410
  • 3
  • 29
  • 57

1 Answers1

1

Try dividing the SoundPool object you are using into multiple instances. Ex. SoundPool sp1, sp2, sp3; Do not use multiple MediaPlayer objects as this will be very slow and inefficient.

Jack Satriano
  • 1,999
  • 1
  • 13
  • 17
  • Hmm, that might work :) Thanks for your reply, I'll go for that solution and see how it turns out. – Araw Sep 13 '12 at 15:59
  • Hi @Araw do you face any problem after making two instances of the same soundpool ? Did the solution work for you? – Saurav Apr 13 '15 at 05:23