本文介绍了媒体播放器VS的Soundpool只有1同时流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我工作在一个单一的声音是每个手机振荡时间玩游戏。
是否有意义使用的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...
这篇关于媒体播放器VS的Soundpool只有1同时流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!