AudioManager()
AudioManager - 音频管理器
操作 BGM, BGS, ME 和 SE 的静态类。
BGM:背景音乐,ME:效果音乐,BGS:背景音效,SE:音效
The static class that handles BGM, BGS, ME and SE.
BGM: Background Music, ME: Music Effect, BGS: Background Sound, SE: Sound Effect
Kind: global function
- AudioManager()
- .playBgm(bgm, pos)
- .playEncryptedBgm(bgm, pos)
- .createDecryptBuffer(url, bgm, pos)
- .replayBgm(bgm)
- .isCurrentBgm(bgm) ⇒
boolean
- .updateBgmParameters(bgm)
- .updateCurrentBgm(bgm, pos)
- .stopBgm()
- .fadeOutBgm(duration)
- .fadeInBgm(duration)
- .playBgs(bgs, pos)
- .replayBgs(bgs)
- .isCurrentBgs(bgs) ⇒
boolean
- .updateBgsParameters(bgs)
- .updateCurrentBgs(bgs, pos)
- .stopBgs()
- .fadeOutBgs(duration)
- .fadeInBgs(duration)
- .playMe(me)
- .updateMeParameters(me)
- .fadeOutMe(duration)
- .stopMe()
- .playSe(se)
- .updateSeParameters(buffer, se)
- .stopSe()
- .playStaticSe(se)
- .loadStaticSe(se)
- .isStaticSe(se) ⇒
boolean
- .stopAll()
- .saveBgm() ⇒
Object
- .saveBgs() ⇒
Object
- .makeEmptyAudioObject() ⇒
Object
- .createBuffer(folder, name) ⇒
Object
- .updateBufferParameters(buffer, configVolume, audio)
- .audioFileExt() ⇒
string
- .shouldUseHtml5Audio() ⇒
boolean
- .checkErrors()
- .checkWebAudioError(webAudio)
AudioManager.playBgm(bgm, pos)
播放 BGM
Play BGM
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgm | Object | BGM 对象 / BGM object |
pos | number | 播放位置 / Play position |
AudioManager.playEncryptedBgm(bgm, pos)
播放加密的 BGM
Play encrypted BGM
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgm | Object | BGM 对象 / BGM object |
pos | number | 播放位置 / Play position |
AudioManager.createDecryptBuffer(url, bgm, pos)
创建解密的缓冲区
Create decrypted buffer
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
url | string | URL 地址 / URL |
bgm | Object | BGM 对象 / BGM object |
pos | number | 播放位置 / Play position |
AudioManager.replayBgm(bgm)
还原 BGM
Replay BGM
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgm | Object | BGM 对象 / BGM object |
AudioManager.isCurrentBgm(bgm) ⇒ boolean
是否当前的 BGM
Check if current BGM
Kind: static method of AudioManager
Returns: boolean
- 是否当前 BGM / Whether current BGM
Param | Type | Description |
---|---|---|
bgm | Object | BGM 对象 / BGM object |
AudioManager.updateBgmParameters(bgm)
更新 BGM 的参数
Update BGM parameters
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgm | Object | BGM 对象 / BGM object |
AudioManager.updateCurrentBgm(bgm, pos)
更新当前的 BGM
Update current BGM
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgm | Object | BGM 对象 / BGM object |
pos | number | 播放位置 / Play position |
AudioManager.stopBgm()
停止 BGM
Stop BGM
Kind: static method of AudioManager
AudioManager.fadeOutBgm(duration)
淡出 BGM
Fade out BGM
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
duration | number | 淡出时长 / Fade out duration |
AudioManager.fadeInBgm(duration)
淡入 BGM
Fade in BGM
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
duration | number | 淡入时长 / Fade in duration |
AudioManager.playBgs(bgs, pos)
播放 BGS
Play BGS
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgs | Object | BGS 对象 / BGS object |
pos | number | 播放位置 / Play position |
AudioManager.replayBgs(bgs)
还原 BGS
Replay BGS
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgs | Object | BGS 对象 / BGS object |
AudioManager.isCurrentBgs(bgs) ⇒ boolean
是否当前的 BGS
Check if current BGS
Kind: static method of AudioManager
Returns: boolean
- 是否当前 BGS / Whether current BGS
Param | Type | Description |
---|---|---|
bgs | Object | BGS 对象 / BGS object |
AudioManager.updateBgsParameters(bgs)
更新 BGS 的参数
Update BGS parameters
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgs | Object | BGS 对象 / BGS object |
AudioManager.updateCurrentBgs(bgs, pos)
更新当前的 BGS
Update current BGS
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
bgs | Object | BGS 对象 / BGS object |
pos | number | 播放位置 / Play position |
AudioManager.stopBgs()
停止 BGS
Stop BGS
Kind: static method of AudioManager
AudioManager.fadeOutBgs(duration)
淡出 BGS
Fade out BGS
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
duration | number | 淡出时长 / Fade out duration |
AudioManager.fadeInBgs(duration)
淡入 BGS
Fade in BGS
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
duration | number | 淡入时长 / Fade in duration |
AudioManager.playMe(me)
播放 ME
Play ME
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
me | Object | ME 对象 / ME object |
AudioManager.updateMeParameters(me)
更新 ME 的参数
Update ME parameters
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
me | Object | ME 对象 / ME object |
AudioManager.fadeOutMe(duration)
淡出 ME
Fade out ME
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
duration | number | 淡出时长 / Fade out duration |
AudioManager.stopMe()
停止 ME
Stop ME
Kind: static method of AudioManager
AudioManager.playSe(se)
播放 SE
Play SE
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
se | Object | SE 对象 / SE object |
AudioManager.updateSeParameters(buffer, se)
更新 SE 的参数
Update SE parameters
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
buffer | Object | 缓冲区对象 / Buffer object |
se | Object | SE 对象 / SE object |
AudioManager.stopSe()
停止 SE
Stop SE
Kind: static method of AudioManager
AudioManager.playStaticSe(se)
播放静态 SE
Play static SE
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
se | Object | SE 对象 / SE object |
AudioManager.loadStaticSe(se)
加载静态 SE
Load static SE
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
se | Object | SE 对象 / SE object |
AudioManager.isStaticSe(se) ⇒ boolean
是否静态 SE
Check if static SE
Kind: static method of AudioManager
Returns: boolean
- 是否静态 SE / Whether static SE
Param | Type | Description |
---|---|---|
se | Object | SE 对象 / SE object |
AudioManager.stopAll()
停止所有音频
Stop all audio
Kind: static method of AudioManager
AudioManager.saveBgm() ⇒ Object
保存 BGM 状态
Save BGM state
Kind: static method of AudioManager
Returns: Object
- BGM 状态对象 / BGM state object
AudioManager.saveBgs() ⇒ Object
保存 BGS 状态
Save BGS state
Kind: static method of AudioManager
Returns: Object
- BGS 状态对象 / BGS state object
AudioManager.makeEmptyAudioObject() ⇒ Object
制作空音频对象
Make empty audio object
Kind: static method of AudioManager
Returns: Object
- 空音频对象 / Empty audio object
AudioManager.createBuffer(folder, name) ⇒ Object
创建缓冲区
Create buffer
Kind: static method of AudioManager
Returns: Object
- 音频缓冲区对象 / Audio buffer object
Param | Type | Description |
---|---|---|
folder | string | 文件夹名 / Folder name |
name | string | 文件名 / File name |
AudioManager.updateBufferParameters(buffer, configVolume, audio)
更新缓冲区参数
Update buffer parameters
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
buffer | Object | 缓冲区对象 / Buffer object |
configVolume | number | 配置音量 / Config volume |
audio | Object | 音频对象 / Audio object |
AudioManager.audioFileExt() ⇒ string
音频文件扩展名
Audio file extension
Kind: static method of AudioManager
Returns: string
- 文件扩展名 / File extension
AudioManager.shouldUseHtml5Audio() ⇒ boolean
是否应该使用 Html5Audio
Whether should use Html5Audio
Kind: static method of AudioManager
Returns: boolean
- 是否使用 Html5Audio / Whether use Html5Audio
AudioManager.checkErrors()
检测错误
Check errors
Kind: static method of AudioManager
AudioManager.checkWebAudioError(webAudio)
检测 WebAudio 错误
Check WebAudio error
Kind: static method of AudioManager
Param | Type | Description |
---|---|---|
webAudio | Object | WebAudio 对象 / WebAudio object |