Skip to content

AudioManager

Defined in: audio/src/AudioManager.ts:58

new AudioManager(sound, config?, random?, fadeQueue?): AudioManager

Defined in: audio/src/AudioManager.ts:74

SoundLibrary

AudioConfig

RandomService

ScopedProcessQueue

AudioManager

get autoMuteOnBlur(): boolean

Defined in: audio/src/AudioManager.ts:357

Pause audio when the window loses focus or the tab is hidden. Default: true.

boolean

set autoMuteOnBlur(value): void

Defined in: audio/src/AudioManager.ts:361

boolean

void


get masterVolume(): number

Defined in: audio/src/AudioManager.ts:244

Volume multiplier for all playback owned by this manager. Default: 1.

number

set masterVolume(volume): void

Defined in: audio/src/AudioManager.ts:248

number

void

_dispose(): void

Defined in: audio/src/AudioManager.ts:397

Internal

Cancel every fade owned by this manager.

void


_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.

void


_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.

ErrorBoundary | undefined

void


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.

SoundHandle

SoundRef

AudioCrossfadeOptions

SoundHandle


getChannelNames(): readonly string[]

Defined in: audio/src/AudioManager.ts:259

Fresh snapshot of configured and created channels, in creation order.

readonly string[]


getChannelVolume(channel): number

Defined in: audio/src/AudioManager.ts:273

Unknown channels have volume 1; reading does not create them.

string

number


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.

SoundRef

boolean


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.

boolean


muteAll(): void

Defined in: audio/src/AudioManager.ts:309

void


muteChannel(channel): void

Defined in: audio/src/AudioManager.ts:277

string

void


offUnlock(cb): void

Defined in: audio/src/AudioManager.ts:351

Remove a listener registered with onUnlock.

() => void

void


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).

() => void

() => void


pauseChannel(channel): void

Defined in: audio/src/AudioManager.ts:293

string

void


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.

SoundRef

AudioPlayOptions

SoundHandle


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.

SoundRef

AudioPlayOptions

SoundHandle


playRandom(aliases, options?): SoundHandle

Defined in: audio/src/AudioManager.ts:218

SoundRef[]

AudioPlayOptions

SoundHandle


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.

SoundRef

AudioPlayOptions

SoundRequestHandle


resumeChannel(channel): void

Defined in: audio/src/AudioManager.ts:301

string

void


setChannelVolume(channel, volume): void

Defined in: audio/src/AudioManager.ts:263

string

number

void


stop(handle): void

Defined in: audio/src/AudioManager.ts:225

SoundHandle

void


stopAll(): void

Defined in: audio/src/AudioManager.ts:237

void


stopChannel(channel): void

Defined in: audio/src/AudioManager.ts:229

string

void


unmuteAll(): void

Defined in: audio/src/AudioManager.ts:315

void


unmuteChannel(channel): void

Defined in: audio/src/AudioManager.ts:285

string

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.