public interface IAudioEffectManager
| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
IAudioEffectManager.ILoadingStateCallback |
static interface |
IAudioEffectManager.IStateObserver |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
getEffectsVolume()
获取音效播放的全局音量
|
int |
getEffectVolume(int effectId)
获取指定音效的播放音量
|
int |
pauseAllEffects()
暂停播放所有音效的
|
int |
pauseEffect(int effectId)
暂停播放指定音效
|
int |
playEffect(int effectId,
int loopCount,
int volume)
播放指定音效文件,必需在调用 preloadEffect 方法预加载音效文件成功后才能调用该方法,否则会失败
|
int |
preloadEffect(String path,
int effectId,
IAudioEffectManager.ILoadingStateCallback callback)
预加载音效资源,并指定唯一音效 id
|
int |
registerStateObserver(IAudioEffectManager.IStateObserver observer)
注册
IAudioEffectManager.IStateObserver 监听音效状态的变换 |
int |
resumeAllEffects()
恢复播放所有音效
|
int |
resumeEffect(int effectId)
恢复播放指定音效
|
int |
setEffectsVolume(int volume)
设置音效播放的全局音量,该方法设置的音量与
setEffectVolume(int, int) 互不影响 |
int |
setEffectVolume(int effectId,
int volume)
设置指定音效的播放音量
|
int |
stopAllEffects()
停止播放所有音效
|
int |
stopEffect(int effectId)
停止播放指定音效
|
int |
unloadAllEffects()
释放预加载的所有音效资源
|
int |
unloadEffect(int effectId)
释放预加载的音效资源
|
int |
unregisterStateObserver(IAudioEffectManager.IStateObserver observer)
取消注册
IAudioEffectManager.IStateObserver 监听音效状态的变换 |
int registerStateObserver(IAudioEffectManager.IStateObserver observer)
IAudioEffectManager.IStateObserver 监听音效状态的变换int unregisterStateObserver(IAudioEffectManager.IStateObserver observer)
IAudioEffectManager.IStateObserver 监听音效状态的变换int preloadEffect(String path, int effectId, IAudioEffectManager.ILoadingStateCallback callback)
path - 音效文件路径,sdcard 下文件需指定绝对路径,例:/sdcard/emulated/0/effect.mp3。
assets 下的文件路径格式为 file:///android_asset/effect.mp3。effectId - 指定的音效文件 idcallback - 加载结束后的回调int unloadEffect(int effectId)
effectId - 指定的音效文件 idint unloadAllEffects()
int playEffect(int effectId,
int loopCount,
int volume)
effectId - 指定的音效文件 id,需与 preload 方法中传入的 id 保持一致loopCount - 音效循环播放的次数volume - 音效播放的音量 [0, 100]preloadEffect(String, int, ILoadingStateCallback)int pauseEffect(int effectId)
effectId - 指定的音效文件 idint pauseAllEffects()
int resumeEffect(int effectId)
effectId - 指定的音效文件 idint resumeAllEffects()
int stopEffect(int effectId)
effectId - 指定的音效文件 idint stopAllEffects()
int setEffectsVolume(int volume)
setEffectVolume(int, int) 互不影响volume - 音量 [0, 100]int getEffectsVolume()
int setEffectVolume(int effectId,
int volume)
effectId - 指定的音效文件 idvolume - 音量 [0, 100]int getEffectVolume(int effectId)
effectId - 指定的音效文件 id