Skip to content

EZ Web Audio / muteAll

Function: muteAll() ​

muteAll(muted): void

Defined in: packages/core/src/index.ts:295

Mute or unmute every sound routed through the shared master bus (R2#7). Sugar over setMasterDestination — see setGlobalVolume for the "only instances created after the first call" caveat, which applies here too.

Unmuting restores the volume last set via setGlobalVolume (default 1).

Parameters ​

muted ​

boolean

true to silence everything, false to restore the last volume

Returns ​

void

Example ​

typescript
import { muteAll } from 'ez-web-audio'

document.getElementById('mute-btn')!.addEventListener('click', () => {
  isMuted = !isMuted
  muteAll(isMuted)
})