MultipleAudioPlayer

MultipleAudioPlayer

new MultipleAudioPlayer()

多源音频播放器

Source:

Members

audioPool :Array.<HTMLAudioElement>

备用的音频元素池

Source:
Type:
  • Array.<HTMLAudioElement>

audios :Array.<HTMLAudioElement>

正在播放的音频元素列表

Source:
Type:
  • Array.<HTMLAudioElement>

panTransition :Timer|null

声像过渡计时器

Source:
Type:

panner :StereoPannerNode

左右声道控制节点

Source:
Type:
  • StereoPannerNode

reverb :ConvolverNode|null

混响(卷积器)节点

Source:
Type:
  • ConvolverNode | null

volumeTransition :Timer|null

音量过渡计时器

Source:
Type:

Methods

continue()

继续播放

Source:

getAudio()

获取音频元素

Source:

getRecentlyAudio(guid) → {audio|undefined}

获取不久前的音频元素

Source:
Parameters:
Name Type Description
guid string

音频文件ID

Returns:
Type:
audio | undefined

pause()

暂停播放

Source:

play(guid, volumeopt, playbackRateopt)

播放音频文件

Source:
Parameters:
Name Type Attributes Default Description
guid string

音频文件ID

volume number <optional>
1

播放音量[0-1]

playbackRate number <optional>
1

播放速度

playAt(guid, location, volumeopt, playbackRateopt)

播放音频文件(距离衰减)

Source:
Parameters:
Name Type Attributes Default Description
guid string

音频文件ID

location Object

具有场景坐标的对象

volume number <optional>
1

播放音量[0-1]

playbackRate number <optional>
1

播放速度

reset()

重置音频播放器

Source:

setLoop(loop)

设置循环

Source:
Parameters:
Name Type Description
loop boolean

循环播放

setPan(pan, easingIdopt, durationopt)

设置声像(左右声道音量)

Source:
Parameters:
Name Type Attributes Description
pan number

声像[-1~+1]

easingId string <optional>

过渡曲线ID

duration number <optional>

持续时间(毫秒)

setReverb(dry, wet, easingIdopt, durationopt)

设置混响

Source:
Parameters:
Name Type Attributes Description
dry number

干声增益[0-1]

wet number

湿声增益[0-1]

easingId string <optional>

过渡曲线ID

duration number <optional>

持续时间(毫秒)

setVolume(volume, easingIdopt, durationopt)

设置音量

Source:
Parameters:
Name Type Attributes Description
volume number

播放音量[0-1]

easingId string <optional>

过渡曲线ID

duration number <optional>

持续时间(毫秒)

stop()

停止播放

Source: