Bob
Bob

Reputation: 363

(Android) How to tell if a sound is playing in soundpool

Is there a way I can tell if a certain sound is playing in SoundPool??? I.E.

    if(MySound./*Command Goes Here*/()==true{
//Do stuff
        }

I would appreciate if you could point me in the right direction or give me the code. I am not able to find any thing that does this on the docs.

Upvotes: 4

Views: 5713

Answers (1)

quietmint
quietmint

Reputation: 14153

This is not possible using SoundPool.

See Android SoundPool: get notified when end of played for two other ideas:

  • Use MediaPlayer, which provides an OnCompletionListener, instead of SoundPool
  • Use MediaPlayer in conjunction with SoundPool. Load the sound in a MediaPlayer beforehand to get the duration and keep track of whether the sound is done playing based its duration when played with SoundPool.

Upvotes: 2

Related Questions