Constructor
new AudioContainer()
Members
buffer
A reference to the AudioBuffer if the sourceNode is a AudioBufferSourceNode.
context
The game audio context used throughout the application.
duration :number
The total duration of the audio source in seconds
Type:
- number
element
A reference to the HTMLMediaElement, if the sourceNode is a MediaElementAudioSourceNode.
failed :boolean
Did the audio file fail to load.
Type:
- boolean
gainNode :GainNode
The GainNode used to control volume
Type:
- GainNode
isBuffer :boolean
Is this container using an AudioBuffer?
Type:
- boolean
LOAD_STATES :number
The sequence of container loading states.
Type:
- number
loaded :boolean
Has the audio file been loaded either fully or for streaming.
Type:
- boolean
loadState :number
- See:
-
- {LOAD_STATES}
Whether we have attempted to load the audio node or not, and whether it failed.
Type:
- number
MAX_BUFFER_DURATION :number
The maximum duration, in seconds, for which an AudioBuffer will be used. Otherwise a streaming media element will be used.
Type:
- number
playing :boolean
Is the audio source currently playing?
Type:
- boolean
sourceNode :AudioBufferSourceNode|MediaElementAudioSourceNode
The Audio Node used to control this sound
Type:
- AudioBufferSourceNode | MediaElementAudioSourceNode
src :string
The audio source path
Type:
- string
Methods
(async) load() → {Promise.<void>}
Load the source node required for playback of this audio source
Returns:
- Type
- Promise.<void>
play(offset, onended)
Begin playback for the source node.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
offset |
number |
0
|
The desired start time |
onended |
function | A callback function for when playback concludes naturally |
stop()
Terminate playback for the source node.