有沒有一種方法可以判斷某個聲音是否在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