Interface: SoundManagerInterface
Defined in: src/sound/interfaces/SoundManagerInterface.ts:7
Properties
channels
> readonly channels: AudioChannelInterface[]
Defined in: src/sound/interfaces/SoundManagerInterface.ts:133
All registered audio channels.
defaultChannelAlias
> defaultChannelAlias: string
Defined in: src/sound/interfaces/SoundManagerInterface.ts:19
The default channel alias used when playing a sound without specifying a
channel. Defaults to "general".
muted
> readonly muted: boolean
Defined in: src/sound/interfaces/SoundManagerInterface.ts:73
Whether all sounds are currently muted. Note that individual channels or media instances may still be muted or unmuted; this is just the global master mute state.
speedAll
> speedAll: number
Defined in: src/sound/interfaces/SoundManagerInterface.ts:13
Deprecated
Global playback speed. This is not a well-supported feature and may be removed in a future release. Use individual sound speed options instead.
volumeAll
> volumeAll: number
Defined in: src/sound/interfaces/SoundManagerInterface.ts:9
Master volume in the range [0, 1].
Methods
add()
> add(alias, options): void
Defined in: src/sound/interfaces/SoundManagerInterface.ts:24
Parameters
alias
string
options
string
Returns
void
Deprecated
Register sound assets directly via PIXI.Assets instead.
addChannel()
> addChannel(alias, options?): AudioChannelInterface | undefined
Defined in: src/sound/interfaces/SoundManagerInterface.ts:122
Add a new audio channel.
Returns the created channel, or undefined if the alias already exists.
Parameters
alias
string | string[]
options?
Returns
AudioChannelInterface | undefined
backgroundLoad()
> backgroundLoad(...alias): Promise<void>
Defined in: src/sound/interfaces/SoundManagerInterface.ts:111
Trigger background loading of one or more sound assets.
Parameters
alias
...string[]
Returns
Promise<void>
backgroundLoadBundle()
> backgroundLoadBundle(alias): Promise<void>
Defined in: src/sound/interfaces/SoundManagerInterface.ts:113
Trigger background loading of a sound bundle.
Parameters
alias
string
Returns
Promise<void>
clear()
> clear(): void
Defined in: src/sound/interfaces/SoundManagerInterface.ts:116
Stop all sounds and clear internal state.
Returns
void
duration()
> duration(alias): number
Defined in: src/sound/interfaces/SoundManagerInterface.ts:66
Duration in seconds of the loaded sound with the given alias.
Parameters
alias
string
Returns
number
export()
> export(): SoundGameState
Defined in: src/sound/interfaces/SoundManagerInterface.ts:138
Export the current sound state, including currently playing sounds and their options, for saving or debugging purposes. This is not guaranteed to be stable across versions and may contain implementation details; it is not intended for use in general application code.
Returns
find()
> find(alias): MediaInterface | undefined
Defined in: src/sound/interfaces/SoundManagerInterface.ts:48
Find a tracked media instance by alias.
Parameters
alias
string
Returns
MediaInterface | undefined
findChannel()
> findChannel(alias): AudioChannelInterface
Defined in: src/sound/interfaces/SoundManagerInterface.ts:130
Find the channel for the given alias, creating it if it does not yet exist.
Parameters
alias
string
Returns
load()
> load(...alias): Promise<void>
Defined in: src/sound/interfaces/SoundManagerInterface.ts:109
Load one or more sound assets.
Parameters
alias
...string[]
Returns
Promise<void>
muteAll()
> muteAll(): this
Defined in: src/sound/interfaces/SoundManagerInterface.ts:75
Mute all sounds.
Returns
this
pause()
> pause(alias): MediaInterface | undefined
Defined in: src/sound/interfaces/SoundManagerInterface.ts:58
Pause a tracked media instance.
Parameters
alias
string
Returns
MediaInterface | undefined
pauseAll()
> pauseAll(): this
Defined in: src/sound/interfaces/SoundManagerInterface.ts:81
Pause all sounds.
Returns
this
pauseUnsavedAll()
> pauseUnsavedAll(channel?): this
Defined in: src/sound/interfaces/SoundManagerInterface.ts:96
Temporarily pause all currently-playing sounds (or just those in the given channel) without persisting the paused state. Useful for overlays / pause menus.
Only sounds that are actively playing at the time of the call are paused; sounds that were already paused beforehand are left untouched so that they remain paused when resumeUnsavedAll is called later.
When called without a channel argument all transient players started with playTransient are also stopped.
Parameters
channel?
string
Returns
this
play()
Call Signature
> play(alias, options?): Promise<MediaInterface>
Defined in: src/sound/interfaces/SoundManagerInterface.ts:32
Plays a sound.
Parameters
alias
string
The media and sound (asset) alias reference.
options?
The options.
Returns
Promise<MediaInterface>
The media instance (resolves immediately if already loaded).
Call Signature
> play(mediaAlias, soundAlias, options?): Promise<MediaInterface>
Defined in: src/sound/interfaces/SoundManagerInterface.ts:33
Parameters
mediaAlias
string
soundAlias
string
options?
Returns
Promise<MediaInterface>
playTransient()
> playTransient(alias, options?): Promise<Player>
Defined in: src/sound/interfaces/SoundManagerInterface.ts:43
Plays a non-persistent ("transient") sound (e.g. UI / menu sounds). Transient playback is not tracked in save/export state.
Parameters
alias
string
options?
Partial<PlayerOptions>
Returns
Promise<Player>
restore()
> restore(data): Promise<void>
Defined in: src/sound/interfaces/SoundManagerInterface.ts:142
Restore a sound state exported by export. This will stop any currently playing sounds and replace them with the sounds specified in the exported state. This is not guaranteed to be stable across versions and may contain implementation details; it is not intended for use in general application code.
Parameters
data
object
Returns
Promise<void>
resume()
> resume(alias): MediaInterface | undefined
Defined in: src/sound/interfaces/SoundManagerInterface.ts:63
Resume a paused media instance.
Parameters
alias
string
Returns
MediaInterface | undefined
resumeAll()
> resumeAll(): this
Defined in: src/sound/interfaces/SoundManagerInterface.ts:83
Resume all sounds.
Returns
this
resumeUnsavedAll()
> resumeUnsavedAll(channel?): this
Defined in: src/sound/interfaces/SoundManagerInterface.ts:102
Resume all sounds (or just those in the given channel) that were paused by
the most recent call to pauseUnsavedAll. Sounds that were already
paused before pauseUnsavedAll was called are not resumed.
Parameters
channel?
string
Returns
this
stop()
> stop(alias): void
Defined in: src/sound/interfaces/SoundManagerInterface.ts:53
Stop a tracked media instance and remove it from the manager.
Parameters
alias
string
Returns
void
stopAll()
> stopAll(): this
Defined in: src/sound/interfaces/SoundManagerInterface.ts:79
Stop all sounds.
Returns
this
stopTransientAll()
> stopTransientAll(): this
Defined in: src/sound/interfaces/SoundManagerInterface.ts:106
Stop all transient media instances started with playTransient.
Returns
this
toggleMuteAll()
> toggleMuteAll(): boolean
Defined in: src/sound/interfaces/SoundManagerInterface.ts:69
Toggle mute on all sounds. Returns the new muted state.
Returns
boolean
unmuteAll()
> unmuteAll(): this
Defined in: src/sound/interfaces/SoundManagerInterface.ts:77
Unmute all sounds.
Returns
this