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 channelsnumber Description.
-
context
-
- Default Value:
- null
- Source:
Properties:
Name Type Description contextDescription Description.
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game Local reference to game.
-
mute
-
- Source:
Properties:
Name Type Description muteboolean 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 noAudioboolean Description.
-
onSoundDecode
-
- Source:
Properties:
Name Type Description onSoundDecodePhaser.Signal Description.
-
touchLocked
-
- Default Value:
- false
- Source:
Properties:
Name Type Description touchLockedboolean Description.
-
usingAudioTag
-
- Default Value:
- false
- Source:
Properties:
Name Type Description usingAudioTagboolean Description.
-
usingWebAudio
-
- Default Value:
- true
- Source:
Properties:
Name Type Description usingWebAudioboolean Description.
-
volume
-
- Source:
Properties:
Name Type Description volumenumber 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 keystring Asset key for the sound.
volumenumber <optional>
1 Default value for the volume.
loopboolean <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 keystring Assets key of the sound to be decoded.
soundPhaser.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: