我工作在一个单一的声音是每个手机振荡时间玩游戏。是否有意义使用的Soundpool和负载在我活动的onCreate声音,还是确定每次创建一个媒体播放器,如下图所示:
I'm working on a game in which one single sound is played each time the phone is shaked. Does it make sense to use a SoundPool and load sounds in the onCreate of my activity, or is it ok to create a mediaplayer each time, as shown below:
private void onShake() {
MediaPlayer mp= MediaPlayer.create(this, whipSound[currentWhip][force]);
mp.start();
}
我的猜测是的Soundpool更好,因为声音是只加载一次。我说得对不对?
My guess is that SoundPool is better because the sounds are loaded only once. Am I right?
感谢
朱利安
正如预期的那样,是的Soundpool更快...
As expected, SoundPool is much faster...