Class enchant.WebAudioSound
Sound wrapper class for Web Audio API (supported on some webkit-based browsers)
- Defined in: enchant.js
- Extends enchant.EventTarget
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
Current playback position (seconds).
|
|
Sound file duration (seconds).
|
|
Volume.
|
Method Summary
Method Attributes | Method Name and Description |
---|---|
clone()
Create a copy of this Sound object.
|
|
<static> |
enchant.WebAudioSound.load(src, type, callback, onerror)
Loads an audio file and creates WebAudioSound object.
|
pause()
Pause playback.
|
|
play(dup)
Begin playing.
|
|
stop()
Stop playing.
|
- Methods borrowed from class enchant.EventTarget:
- addEventListener
- clearEventListener
- dispatchEvent
- on
- removeEventListener
Class Detail
enchant.WebAudioSound()
Field Detail
{Number}
currentTime
Current playback position (seconds).
{Number}
duration
Sound file duration (seconds).
{Number}
volume
Volume. 0 (muted) ~ 1 (full volume).
Method Detail
-
{enchant.WebAudioSound} clone()Create a copy of this Sound object.
- Returns:
- {enchant.WebAudioSound} Copied Sound.
-
Loads an audio file and creates WebAudioSound object.
- Parameters:
- {String} src
- Path of the audio file to be loaded.
- {String} type Optional
- MIME Type of the audio file.
- {Function} callback Optional
- on load callback.
- {Function} onerror Optional
- on error callback.
- Returns:
- {enchant.WebAudioSound} WebAudioSound
-
pause()Pause playback.
-
play(dup)Begin playing.
- Parameters:
- {Boolean} dup Optional, Default: false
- If true, Object plays new sound while keeps last sound.
-
stop()Stop playing.