有没有一种方法可以判断某个声音是否在SoundPool中播放? I.E.(Android)如何判断声音是否在soundpool中播放
if(MySound./*Command Goes Here*/()==true{
//Do stuff
}
如果您能指出我正确的方向或给我的代码,我将不胜感激。我无法在文档中找到任何这样的事情。
有没有一种方法可以判断某个声音是否在SoundPool中播放? I.E.(Android)如何判断声音是否在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
播放时根据持续时间是否完成播放。
[Android SoundPool:当播放结束时得到通知]的可能重复(http://stackoverflow.com/questions/4436055/android-soundpool-get-notified-when-end-of-played) – bobs