soundPool常用属性
来源:互联网 发布:win7建立网络共享 编辑:程序博客网 时间:2024/06/02 03:50
Soundpool主要用于游戏中播放无延时的短促音效,在开发中应该将长度小于7s的声音资源放进SoundPool中,否则可能加载失败或内存占用过大。
SoundPool构造器及常用方法如下:
构造器或方法名
方法含义
各个参数含义
SoundPool(int maxStreams, int streamType, int srcQuality)
构造函数
maxStreams:用于设置同时能够播放多少个音效
streamType:音频类型,在游戏中通常设置为AudioManager.STREAM_MUSIC
srcQuality:音频质量,目前没有作用,默认值0
load(Context context, int resId, int priority)
加载音频文件
Context:上下文
resId:音效资源ID
Priority:优先级,目前没有作用,默认值1
play(int soundID, float leftVolume, float rightVolume, int priority, int loop, float rate)
播放音效
soundID:要播放的音效id
leftVolume:左声道音量range = 0.0 to 1.0
rightVolume:右声道音量range = 0.0 to 1.0
Priority:优先度,0为最低
Loop:音效播放的循环次数,0为不循环,-1为永远循环
Rate:音效的回放速度,该值在.0.5-->2.0f,1.0为正常速度
pause(int streamID)
暂停音效
streamID:音效ID
stop(int streamID)
停止音效
streamID:音效ID
- soundPool常用属性
- Android常用控件之SoundPool
- soundpool
- SoundPool
- SoundPool
- soundpool
- soundpool
- SoundPool
- SoundPool
- SoundPool
- SoundPool
- SoundPool
- SoundPool
- 游戏音乐MediaPlayer和SoundPool常用的一些方法
- 常用属性
- 常用属性
- SoundPool使用
- android - SoundPool
- 安波_多智能体系统研究进展与挑战
- [DP]Longest Increasing Subsequence
- Python 3中套接字编程中遇到TypeError: 'str' does not support the buffer interface的解决办法
- 整合Hadoop2.2.0+HBase0.96+Hive0.12+MySql集群
- 2013 Asia Hangzhou Regional Contest(HDU 4770 4771 4772 )
- soundPool常用属性
- Determining if a View is Hardware Accelerated
- 经验分享:java.lang.NoClassDefFoundError:Clould not initialize class
- Android异常处理框架
- simple_load_string对‘&’符号敏感 怎么解决
- 使用Xcode和Instruments调试解决iOS内存泄露
- UI设计简单原则
- mysql5将其连接的等待时间(wait_timeout)缺省为8小时
- 简单 android popupwindow 实现