A sound effect instance you can play and stop.
Kind: global class
Number
Boolean
Boolean
Number
Number
Number
Boolean
Boolean
Boolean
Promise
Promise
Boolean
Create a sound instance.
Param | Type | Description |
---|---|---|
sfxManager | Sfx |
Sfx manager instance. |
url | String |
Sound URL or source. |
Number
Get 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. |
Boolean
Get 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. |
Boolean
Get 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. |
Number
Get 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. |
Number
Get 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. |
Number
Get track duration.
Kind: instance property of SoundInstance
Returns: Number
- Sound duration in seconds.
Boolean
Get if sound is currently paused.
Kind: instance property of SoundInstance
Returns: Boolean
- True if sound is currently paused.
Boolean
Get if sound is currently playing.
Kind: instance property of SoundInstance
Returns: Boolean
- True if sound is currently playing.
Boolean
Get 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
Promise
Play sound.
Kind: instance method of SoundInstance
Returns: Promise
- Promise to return when sound start playing.
Pause the sound.
Kind: instance method of SoundInstance
Promise
Replay sound from start.
Kind: instance method of SoundInstance
Returns: Promise
- Promise to return when sound start playing.
Boolean
Stop the sound and go back to start.
Kind: instance method of SoundInstance
Returns: Boolean
- True if successfully stopped sound, false otherwise.