Chinaunix首页 | 论坛 | 博客
  • 博客访问: 36575
  • 博文数量: 25
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 270
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-28 17:38
文章分类
文章存档

2013年(25)

我的朋友

分类: Android平台

2013-04-09 13:16:45

短时间的音效播放实现SoundPool
 
实现技术: android.media.SoundPool实现 (管理和播放应用程序的声音资源,直接加载到内存)。

一.基础知识:

1. 创建一个SoundPool :
   我们先看看SoundPool函数的定义,如下:

[java]
  public SoundPool( 
    int maxStream, // 同时播放的流的最大数量  
    int streamType,// 流的类型,一般为STREAM_MUSIC  
    int srcQuality // 采样率转化质量,当前无效果,使用0作为默认值  
    )  


  public SoundPool(
 int maxStream, // 同时播放的流的最大数量
 int streamType,// 流的类型,一般为STREAM_MUSIC
 int srcQuality // 采样率转化质量,当前无效果,使用0作为默认值
 )     eg.
  SoundPool soundPool = new SoundPool(3, AudioManager.STREAM_MUSIC, 0);
  创建了一个最多支持3个流同时播放的,类型标记为音乐的SoundPool。


 
阅读(501) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~