Constructor
new WebAudioSound()
Extends
Members
gain
Properties:
Type |
Description |
GainNode
|
|
loadDefer
Audio buffer for Web Audio playback
Properties:
Type |
Attributes |
Description |
Promise.<AudioBuffer>
|
<nullable>
|
|
- Overrides:
pausedAtTime
When is the audio paused at, in ms, of the audio. e.g. 60000 means audio paused at 1min
Properties:
source
Properties:
Type |
Attributes |
Description |
AudioBufferSourceNode
|
<nullable>
|
|
startTime
Absolute timestamp of the time when audio started playing. In ms.
Properties:
Methods
(static) getAudioContext() → (nullable) {AudioContext}
Get a lazily initialized, memoized AudioContext.
Return null when Web Audio is not available
Returns:
-
Type
-
AudioContext
fade(options) → {Promise}
Fade the sound, will stop and override existing fade.
Parameters:
Name |
Type |
Description |
options |
Object
|
Properties
Name |
Type |
Description |
fromVolume |
number
|
|
toVolume |
number
|
|
finalVolume |
number
|
|
|
- Inherited From:
Returns:
- Promise what resolve when the fade ends
-
Type
-
Promise
objectToBeSerialized(key) → {object|Serializable}
Return an object to be serialized for a specific key.
Parameters:
Name |
Type |
Description |
key |
string
|
The key of property to be serialized |
- Overrides:
- Implements:
Returns:
- An object or serializable to be saved for the specific key, return undefined = not to be saved.
-
Type
-
object
|
Serializable
pause() → {Promise}
Pause the sound
Operation is queued.
- Overrides:
Returns:
-
Type
-
Promise
play(filepathopt) → {Promise}
Load (optional) then play the sound.
Operation is queued.
Parameters:
Name |
Type |
Attributes |
Description |
filepath |
string
|
<optional>
|
The audio's filename without extension |
- Overrides:
Returns:
-
Type
-
Promise
setFile(filepath) → {Promise}
Load audio.
Operation is queued.
Parameters:
Name |
Type |
Description |
filepath |
string
|
The audio's filename without extension |
- Overrides:
Returns:
-
Type
-
Promise
setLoop(loop)
Parameters:
Name |
Type |
Description |
loop |
boolean
|
|
- Overrides:
setPan(pan)
Parameters:
Name |
Type |
Description |
pan |
number
|
from -1 to 1, 0 is balanced |
- Inherited From:
setTime(time)
Seek to middle of the sound
Parameters:
Name |
Type |
Description |
time |
number
|
in milisecond |
- Overrides:
setVolume(volume)
Parameters:
Name |
Type |
Description |
volume |
number
|
Volume, from 0 - 1 |
- Overrides:
stop() → {Promise}
Stop the sound
Operation is queued.
- Overrides:
Returns:
-
Type
-
Promise
stopFade(setFinalVolume) → {Promise}
Stop fade
Parameters:
Name |
Type |
Description |
setFinalVolume |
boolean
|
Should set the sound to it's final volume or just stop fade. |
- Inherited From:
Returns:
-
Type
-
Promise