有什么方法可以告诉我SoundPool中是否正在播放某种声音???
即
if(MySound./*Command Goes Here*/()==true{
//Do stuff
}
如果您能指出正确的方向或给我代码,我将不胜感激。我无法在文档中找到执行此操作的任何操作。
最佳答案
使用SoundPool
是不可能的。
有关其他两个想法,请参见Android SoundPool: get notified when end of played:
MediaPlayer
来提供OnCompletionListener
,而不是SoundPool
MediaPlayer
一起使用SoundPool
。事先将声音加载到MediaPlayer
中以获取持续时间,并根据使用SoundPool
播放时的持续时间跟踪声音是否播放完毕。