-
Notifications
You must be signed in to change notification settings - Fork 4
Audio
Eric edited this page Feb 17, 2023
·
8 revisions
Audio
is an object that makes the link between stored audio files in Cache andHowler.js
. All sounds added to thepreload
tag ofapp.json
will be stored in OGX.JS's cache and can be accessed or played usingAudio
. All sounds are played via Howler.
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"]
}, ...
}
To play a cached sound (
_LOOP_
isfalse
by default and_VOLUME_
set to1
).
OGX.Audio.play(_ID_, _VOLUME_, _LOOP_);
A practical example
OGX.Audio.play('click', 0.5);
To retrieve a preloaded sound
OGX.Audio.get(_ID_);
- Welcome
- Changelog
- Structure
- Configuration
- Getting started
- CLI
- Poly
- Core
- Templating
- Routing
- Controllers
- Components
- Extra Components
- Helpers
- Styling
- Debugging