Reputation: 7101
I am using SoundPool in order to play some sounds using timers in my applications. Does anyone know if there is an in-built queue where it will queue files and play them only when the previous files are finished?
Do I have to write my own implementation of a SoundPool queue?
Upvotes: 0
Views: 284
Reputation: 5411
I have had a similar issues in a couple of apps that relied heavily on SoundPool. There is no "in-built queue" or detection of when a sound has finished. Also annoyingly you can't get the play length of loaded sounds from SoundPool either. In your searches I'm sure you've come across many people complaining about this.
For my purposes I got around this by first briefly loading each sound into MediaPlayer to get and store it's play length. Then used these lengths to signify when playback will have stopped.
Unfortunately the audio side of things is a well recognised weak point in Android. The general advice is if you want to get accurate and have good control, then you need to turn to the NDK rather than using SoundPool or MediaPlayer, sorry.
Upvotes: 1