(Android版)如何判断一个声音在玩的Soundpool

(Android版)如何判断一个声音在玩的Soundpool

问题描述:

有没有一种方法,如果某个声音在播放的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
        }

我AP preciate如果你能指出我在正确的方向,或给我的code。我无法找到,这是否对文档的任何事情。
在先进的感谢。

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. Thanks in advanced.

这是不可能使用的Soundpool

请参阅Android的Soundpool:得到通知时起到结束的另外两个思路:

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


  • 使用的MediaPlayer ,它提供了一个 OnCompletionListener ,而不是的Soundpool

  • 使用的MediaPlayer 的Soundpool 一起。加载在的MediaPlayer 事先声音得到持续时间和跟踪的声音是否是做打根据其持续时间与的Soundpool $播放时C $ C>。

  • 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.