new TonePlayer(options)
This class handles the playing of tones.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
Extends
- SoundPlayer
Methods
(static) accept() → {Object|undefined}
Determine whether this player can play the given sound.
Parameters:
Type | Description |
---|---|
module:sound.Sound | the sound |
- Source:
Returns:
an instance of TonePlayer that can play the given sound or undefined otherwise
- Type
- Object | undefined
getDuration() → {number}
Get the duration of the sound.
- Source:
Returns:
the duration of the sound, in seconds
- Type
- number
play(loopsopt)
Start playing the sound.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
loops |
boolean |
<optional> |
how many times to repeat the sound after it has played once. If loops == -1, the sound will repeat indefinitely until stopped. |
- Source:
setLoops(loops)
Set the number of loops.
Parameters:
Name | Type | Description |
---|---|---|
loops |
number | how many times to repeat the track after it has played once. If loops == -1, the track will repeat indefinitely until stopped. |
- Source:
setVolume(volume, muteopt)
Set the volume of the tone.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
volume |
Integer | the volume of the tone | ||
mute |
boolean |
<optional> |
false | whether or not to mute the tone |
- Source:
stop()
Stop playing the sound immediately.
- Source: