Mute all audios in a scene?

I know that I can iterate every audio and stop/pause it but is there any general switch to disable sounds?

Thank you

Hello,

The BABYLON.AUDIOENGINE has a method setGlobalVolume. That may help you.
AudioEngine - Babylon.js Documentation

BABYLON.Engine.audioEngine.audioContext.suspend()
BABYLON.Engine.audioEngine.audioContext.resume()

These seem to work. Are these safe to use as a global mute toggle?

suspend is more like a pause than a mute only.

@sebavan So what’s the answer?

Is this it?

    toggleAudio() {
        const audio = BABYLON.Engine.audioEngine!;
        if (audio.getGlobalVolume() === 0) audio.setGlobalVolume(1);
        else audio.setGlobalVolume(0);
    }

EDIT: Yep, that looks like it does the trick. It is not documented anywhere in Babylon docs what values to use :smiling_face_with_tear:, but looks like values between 0 and 1 are working.

if you want to mute unmute, global volume is the way indeed as the suspend/resume context trick will pause and not mute only.