Android playing sound in game

ぐ巨炮叔叔 提交于 2019-12-12 02:02:08

问题


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.


回答1:


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.

Service documentation: http://developer.android.com/guide/components/services.html

SoundPool is best used for playing short sound clips like sound effects as you've already noticed :-)

Good luck!



来源:https://stackoverflow.com/questions/25351337/android-playing-sound-in-game

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!