new SoundManager(game)
Sound Manager constructor.
Parameters:
Name | Type | Description |
---|---|---|
game |
Phaser.Game | reference to the current game instance. |
- Source:
Members
-
channels
-
- Default Value:
- 32
- Source:
Properties:
Name Type Description channels
number Description.
-
context
-
- Default Value:
- null
- Source:
Properties:
Name Type Description context
Description Description.
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game Local reference to game.
-
mute
-
- Source:
Properties:
Name Type Description mute
boolean Gets or sets the muted state of the SoundManager. This effects all sounds in the game.
-
noAudio
-
- Default Value:
- false
- Source:
Properties:
Name Type Description noAudio
boolean Description.
-
onSoundDecode
-
- Source:
Properties:
Name Type Description onSoundDecode
Phaser.Signal Description.
-
touchLocked
-
- Default Value:
- false
- Source:
Properties:
Name Type Description touchLocked
boolean Description.
-
usingAudioTag
-
- Default Value:
- false
- Source:
Properties:
Name Type Description usingAudioTag
boolean Description.
-
usingWebAudio
-
- Default Value:
- true
- Source:
Properties:
Name Type Description usingWebAudio
boolean Description.
-
volume
-
- Source:
Properties:
Name Type Description volume
number Gets or sets the global volume of the SoundManager, a value between 0 and 1.
Methods
-
add(key, volume, loop)
-
Adds a new Sound into the SoundManager.
Parameters:
Name Type Argument Default Description key
string Asset key for the sound.
volume
number <optional>
1 Default value for the volume.
loop
boolean <optional>
false Whether or not the sound will loop.
- Source:
-
<protected> boot()
-
Initialises the sound manager.
- Source:
-
decode(key, sound)
-
Decode a sound by its assets key.
Parameters:
Name Type Argument Description key
string Assets key of the sound to be decoded.
sound
Phaser.Sound <optional>
Its buffer will be set to decoded data.
- Source:
-
pauseAll()
-
Pauses all the sounds in the game.
- Source:
-
resumeAll()
-
resumes every sound in the game.
- Source:
-
stopAll()
-
Stops all the sounds in the game.
- Source:
-
unlock()
-
Enables the audio, usually after the first touch.
- Source:
-
update()
-
Updates every sound in the game.
- Source: