Audio isEnabled method

isEnabled(): boolean

Determines if game sound should be audible at this instant.

Requirements

  • Your game must not omit sound while isEnabled returns false. When the value changes to false you must stop playing any sound immediately. When the value changes to true you must immediately resume any sound that would have been playing.
    • You can either use subscribe to be notified when this value changes, or you can check isEnabled in every game loop.
    • If you do use subscribe you must also use isEnabled to get the initial value.

Examples

engine.sound.setMute(!GameSnacks.audio.isEnabled);
GameSnacks.audio.subscribe((isEnabled) => engine.sound.setMute(!isEnabled));