
A sound effect instance you can play and stop.
Kind: global class
NumberBooleanBooleanNumberNumberNumberBooleanBooleanBooleanPromisePromiseBooleanCreate a sound instance.
| Param | Type | Description |
|---|---|---|
| sfxManager | Sfx |
Sfx manager instance. |
| url | String |
Sound URL or source. |
NumberGet sound effect playback rate.
Kind: instance property of SoundInstance
Returns: Number - Playback rate.
Set playback rate.
Kind: instance property of SoundInstance
| Param | Type | Description |
|---|---|---|
| val | Number |
Playback value to set. |
BooleanGet if to preserve pitch while changing playback rate.
Kind: instance property of SoundInstance
Returns: Boolean - Preserve pitch state of the sound instance.
Set if to preserve pitch while changing playback rate.
Kind: instance property of SoundInstance
| Param | Type | Description |
|---|---|---|
| val | Boolean |
New preserve pitch value to set. |
BooleanGet if playing in loop.
Kind: instance property of SoundInstance
Returns: Boolean - If this sound should play in loop.
Set if playing in loop.
Kind: instance property of SoundInstance
| Param | Type | Description |
|---|---|---|
| value | Boolean |
If this sound should play in loop. |
NumberGet volume.
Kind: instance property of SoundInstance
Returns: Number - Sound effect volume.
Set volume.
Kind: instance property of SoundInstance
| Param | Type | Description |
|---|---|---|
| value | Number |
Sound effect volume to set. |
NumberGet current time in track.
Kind: instance property of SoundInstance
Returns: Number - Current time in playing sound.
Set current time in track.
Kind: instance property of SoundInstance
| Param | Type | Description |
|---|---|---|
| value | Number |
Set current playing time in sound track. |
NumberGet track duration.
Kind: instance property of SoundInstance
Returns: Number - Sound duration in seconds.
BooleanGet if sound is currently paused.
Kind: instance property of SoundInstance
Returns: Boolean - True if sound is currently paused.
BooleanGet if sound is currently playing.
Kind: instance property of SoundInstance
Returns: Boolean - True if sound is currently playing.
BooleanGet if finished playing.
Kind: instance property of SoundInstance
Returns: Boolean - True if sound reached the end and didn’t loop.
Dispose the audio object when done playing the sound. This will call dispose() automatically when audio ends.
Kind: instance method of SoundInstance
Dispose the audio object and clear its resources. When playing lots of sounds its important to call dispose on sounds you no longer use, to avoid getting hit by “Blocked attempt to create a WebMediaPlayer” exception.
Kind: instance method of SoundInstance
PromisePlay sound.
Kind: instance method of SoundInstance
Returns: Promise - Promise to return when sound start playing.
Pause the sound.
Kind: instance method of SoundInstance
PromiseReplay sound from start.
Kind: instance method of SoundInstance
Returns: Promise - Promise to return when sound start playing.
BooleanStop the sound and go back to start.
Kind: instance method of SoundInstance
Returns: Boolean - True if successfully stopped sound, false otherwise.