Reputation: 2478
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!
Upvotes: 0
Views: 387
Reputation: 2029
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.
Upvotes: 1