SoundManagerHowler

Howler.js is used for audio handling in the app, this module adds some functions to help integrate it

Author
  • Mark Mayes / mm-dev
License
  • GPL-3.0-only

Methods

(static) init(_data)

Source
Preload sounds, set them up as Howl objects and store them in SoundManagerHowler.allAudio_ob using their ID as a key
Parameters
Name Type Description
_data object
Name Type Description
sound_ar Array.<object>

Info about sounds to preload

preloadCallback function

Function to call when all the sounds have finshed loading

(static) onAudioEventGeneric(howlerID, message)

Source
Handle any miscellaneous Howler events
Parameters
Name Type Description
howlerID string

Howlers ID for the sound this event pertains to

message string

Message about the event

(static) onAudioLoad()

Source
A sound file has finished loading
  • Broadcast an itempreload event, including details about how many sounds have loaded so far
  • If all sounds have finished loading, call the preloadCallback() function that was passed into SoundManagerHowler.init()

(static) playSoundById(_id)

Source
Find a sound by its ID and play it
Parameters
Name Type Description
_id string

(static) setMuteState(_state)

Source
Set global mute state
Parameters
Name Type Description
_state boolean

Desired mute state (eg true will mute all sounds)