AudioManager
Defined in: audio/src/AudioManager.ts:58
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new AudioManager(
sound,config?,random?,fadeQueue?):AudioManager
Defined in: audio/src/AudioManager.ts:74
Parameters
Section titled “Parameters”SoundLibrary
config?
Section titled “config?”random?
Section titled “random?”RandomService
fadeQueue?
Section titled “fadeQueue?”ScopedProcessQueue
Returns
Section titled “Returns”AudioManager
Accessors
Section titled “Accessors”autoMuteOnBlur
Section titled “autoMuteOnBlur”Get Signature
Section titled “Get Signature”get autoMuteOnBlur():
boolean
Defined in: audio/src/AudioManager.ts:357
Pause audio when the window loses focus or the tab is hidden. Default: true.
Returns
Section titled “Returns”boolean
Set Signature
Section titled “Set Signature”set autoMuteOnBlur(
value):void
Defined in: audio/src/AudioManager.ts:361
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”void
masterVolume
Section titled “masterVolume”Get Signature
Section titled “Get Signature”get masterVolume():
number
Defined in: audio/src/AudioManager.ts:244
Volume multiplier for all playback owned by this manager. Default: 1.
Returns
Section titled “Returns”number
Set Signature
Section titled “Set Signature”set masterVolume(
volume):void
Defined in: audio/src/AudioManager.ts:248
Parameters
Section titled “Parameters”volume
Section titled “volume”number
Returns
Section titled “Returns”void
Methods
Section titled “Methods”_dispose()
Section titled “_dispose()”_dispose():
void
Defined in: audio/src/AudioManager.ts:397
Internal
Cancel every fade owned by this manager.
Returns
Section titled “Returns”void
_handleGesture()
Section titled “_handleGesture()”_handleGesture():
void
Defined in: audio/src/AudioManager.ts:379
Internal
Called by AudioPlugin after a user gesture fires. Fires pending
onUnlock listeners if the context has become running.
Returns
Section titled “Returns”void
_setErrorBoundary()
Section titled “_setErrorBoundary()”_setErrorBoundary(
boundary):void
Defined in: audio/src/AudioManager.ts:392
Internal
Wire the error boundary so a throwing developer callback is attributed
instead of escaping into @pixi/sound. Called by AudioPlugin.install.
Parameters
Section titled “Parameters”boundary
Section titled “boundary”ErrorBoundary | undefined
Returns
Section titled “Returns”void
crossfade()
Section titled “crossfade()”crossfade(
outgoing,next,options):SoundHandle
Defined in: audio/src/AudioManager.ts:123
Fade outgoing to silence while fading a new sound in. Returns the new
handle immediately; the outgoing handle stops when its fade completes.
Parameters
Section titled “Parameters”outgoing
Section titled “outgoing”options
Section titled “options”Returns
Section titled “Returns”getChannelNames()
Section titled “getChannelNames()”getChannelNames(): readonly
string[]
Defined in: audio/src/AudioManager.ts:259
Fresh snapshot of configured and created channels, in creation order.
Returns
Section titled “Returns”readonly string[]
getChannelVolume()
Section titled “getChannelVolume()”getChannelVolume(
channel):number
Defined in: audio/src/AudioManager.ts:273
Unknown channels have volume 1; reading does not create them.
Parameters
Section titled “Parameters”channel
Section titled “channel”string
Returns
Section titled “Returns”number
hasSound()
Section titled “hasSound()”hasSound(
ref):boolean
Defined in: audio/src/AudioManager.ts:214
Whether a sound is registered under ref’s alias — preloaded with
sound(...) or added with registerSound(). This is the same check that
makes play throw, so it is the guard for an alias the game assembles at
runtime.
It reports nothing about whether audio can be heard. The browser’s autoplay unlock is AudioManager.isUnlocked, and channel mute is AudioManager.muteChannel.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
isUnlocked()
Section titled “isUnlocked()”isUnlocked():
boolean
Defined in: audio/src/AudioManager.ts:327
Whether the underlying AudioContext is running (i.e. audio will play).
Browsers suspend the context on page load until a user gesture; this is
purely a browser-level capability check and is not affected by
autoMuteOnBlur.
Returns
Section titled “Returns”boolean
muteAll()
Section titled “muteAll()”muteAll():
void
Defined in: audio/src/AudioManager.ts:309
Returns
Section titled “Returns”void
muteChannel()
Section titled “muteChannel()”muteChannel(
channel):void
Defined in: audio/src/AudioManager.ts:277
Parameters
Section titled “Parameters”channel
Section titled “channel”string
Returns
Section titled “Returns”void
offUnlock()
Section titled “offUnlock()”offUnlock(
cb):void
Defined in: audio/src/AudioManager.ts:351
Remove a listener registered with onUnlock.
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”void
onUnlock()
Section titled “onUnlock()”onUnlock(
cb): () =>void
Defined in: audio/src/AudioManager.ts:337
Fires cb once when audio becomes playable. If already unlocked, fires
synchronously. Returns a disposer that removes the pending listener (no-op
once it has fired).
Parameters
Section titled “Parameters”() => void
Returns
Section titled “Returns”() => void
pauseChannel()
Section titled “pauseChannel()”pauseChannel(
channel):void
Defined in: audio/src/AudioManager.ts:293
Parameters
Section titled “Parameters”channel
Section titled “channel”string
Returns
Section titled “Returns”void
play()
Section titled “play()”play(
ref,options?):SoundHandle
Defined in: audio/src/AudioManager.ts:115
Play a preloaded or registered sound. Accepts the alias or the handle
sound() returned. Throws when the alias resolves to nothing — that is
a typo, or playback before the asset was preloaded.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”playOnce()
Section titled “playOnce()”playOnce(
ref,options?):SoundHandle
Defined in: audio/src/AudioManager.ts:162
Play one shared instance per alias and channel. Repeated calls retain the same implicit owner, so callers may ignore the returned sound handle.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”playRandom()
Section titled “playRandom()”playRandom(
aliases,options?):SoundHandle
Defined in: audio/src/AudioManager.ts:218
Parameters
Section titled “Parameters”aliases
Section titled “aliases”SoundRef[]
options?
Section titled “options?”Returns
Section titled “Returns”requestOnce()
Section titled “requestOnce()”requestOnce(
ref,options?):SoundRequestHandle
Defined in: audio/src/AudioManager.ts:185
Own one request for playback shared by alias and channel. Releasing the
request stops the sound only after every request is gone and no playOnce
owner remains.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”resumeChannel()
Section titled “resumeChannel()”resumeChannel(
channel):void
Defined in: audio/src/AudioManager.ts:301
Parameters
Section titled “Parameters”channel
Section titled “channel”string
Returns
Section titled “Returns”void
setChannelVolume()
Section titled “setChannelVolume()”setChannelVolume(
channel,volume):void
Defined in: audio/src/AudioManager.ts:263
Parameters
Section titled “Parameters”channel
Section titled “channel”string
volume
Section titled “volume”number
Returns
Section titled “Returns”void
stop()
Section titled “stop()”stop(
handle):void
Defined in: audio/src/AudioManager.ts:225
Parameters
Section titled “Parameters”handle
Section titled “handle”Returns
Section titled “Returns”void
stopAll()
Section titled “stopAll()”stopAll():
void
Defined in: audio/src/AudioManager.ts:237
Returns
Section titled “Returns”void
stopChannel()
Section titled “stopChannel()”stopChannel(
channel):void
Defined in: audio/src/AudioManager.ts:229
Parameters
Section titled “Parameters”channel
Section titled “channel”string
Returns
Section titled “Returns”void
unmuteAll()
Section titled “unmuteAll()”unmuteAll():
void
Defined in: audio/src/AudioManager.ts:315
Returns
Section titled “Returns”void
unmuteChannel()
Section titled “unmuteChannel()”unmuteChannel(
channel):void
Defined in: audio/src/AudioManager.ts:285
Parameters
Section titled “Parameters”channel
Section titled “channel”string
Returns
Section titled “Returns”void
Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/audio.md.