Audio - globules-io/OGX.JS GitHub Wiki
Audiois an object that makes the link between stored audio files in Cache andHowler.js. All sounds added to thepreloadtag ofapp.jsonwill be stored in OGX.JS's cache and can be accessed or played usingAudio. All sounds are played via Howler.
Preload
OGX.JS provides a mechanism to preload and store sounds. Add references to the sounds to be preload in the app.json configuration such as
{...,
preload:{
"/snd":["click.mp3", "msg.mp3"]
}, ...
}
Play
To play a cached sound (
_LOOP_isfalseby default and_VOLUME_set to1).
OGX.Audio.play(_ID_, _VOLUME_, _LOOP_);
A practical example
OGX.Audio.play('click', 0.5);
Get
To retrieve a preloaded sound
OGX.Audio.get(_ID_);