<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<head><meta forua="true" http-equiv="Cache-Control" content="max-age=0" /></head>
<card title="Android开发游戏音效代码实例参考" id="card1">
<p> 游客</p><p>
标题:Android开发游戏音效代码实例参考<br/>
正文:<br/>
代码示例如下：//音效的音量　　int streamVolume;　　//定义SoundPool 对象 private SoundPool soundPool;　　//定义HASH表 private HashMap&amp;lt;Integer, Integer&amp;gt; soundPoolMap;　　/***************************@camnpr************************************ * Function: initSounds();　　* Parameters: null　　* Returns: None.　　* Description: 初始化声音系统　　* Notes: none.　　************************@郑州网建***************************************/　　public void initSounds() { //初始化soundPool 对象,第一个参数是允许有多少个声音流同时播放,第2个参数是声音类型,第三个参数是声音的品质 soundPool = new SoundPool(100, AudioManager.STREAM_MUSIC, 100);　　//初始化HASH表 soundPoolMap = new HashMap&amp;lt;Integer, Integer&amp;gt;();　　//获得声音设备和设备音量 AudioManager mgr = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);　　streamVolume = mgr.getStreamVolume(AudioManager.STREAM_MUSIC);　　}　　/*************************************************************** * Function: loadSfx();　　* Parameters: null　　* Returns: None.　　* Description: 加载音效资源　　* Notes: none.　　*********************************@camnpr****************<br/><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1736&amp;Page=1">[&lt;&lt;]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1736&amp;Page=1">[[1]]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1736&amp;Page=2">[2]</a><a href="http://camnpr.com/wap.asp?mode=WAP&amp;act=View&amp;id=1736&amp;Page=2">[&gt;&gt;]</a><br/>
<br/>
<a href="wap.asp?act=Com&amp;id=1736">查看评论(0)</a><br/>
<a href="wap.asp?act=AddCom&amp;inpId=1736">发表评论</a><br/><br/>

<br/>

<br/>
<a href="http://camnpr.com/wap.asp">首页</a>
</p>
</card>
</wml>