媒体播放器VS的Soundpool只有1同时流媒体播放器、VS、Soundpool

2023-09-06 05:33:51 作者:你心是海我是鱼。

我工作在一个单一的声音是每个手机振荡时间玩游戏。是否有意义使用的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...