Android的播放声音在游戏中 [英] Android playing sound in game
问题描述
我在OpenGL 2.0制作的游戏,我想在同一时间播放多个声音。
我努力了:
的Soundpool,但我的配乐非常大,我不能加载它们。
MediaPlayer的,这项工作确定,但比FPS很低。
I'm making game in OpenGL 2.0 and I want to play multiple sounds in same time. I have tried: SoundPool-but my soundtracks are very large and i can't load them. MediaPlayer-this work ok but than FPS are very low.
推荐答案
您想要做的就是创建一个服务运行的MediaPlayer和播放音乐。该服务将并行运行到Android进程,不会影响它的性能。
What you want to do is create a Service to run MediaPlayer and play the music. The Service will run in parallel to your Android process and will not effect it's performance.
服务文档: http://developer.android.com/guide/components/services html的
的Soundpool最适合用于播放短声音剪辑般的声音效果,你已经注意到: - )
SoundPool is best used for playing short sound clips like sound effects as you've already noticed :-)
祝你好运!
这篇关于Android的播放声音在游戏中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!