MCPcopy
hub / github.com/goldfire/howler.js / loadSound

Function loadSound

src/howler.core.js:2490–2507  ·  view source on GitHub ↗
(self, buffer)

Source from the content-addressed store, hash-verified

2488 * @param {Object} buffer The decoded buffer sound source.
2489 */
2490 var loadSound = function(self, buffer) {
2491 // Set the duration.
2492 if (buffer && !self._duration) {
2493 self._duration = buffer.duration;
2494 }
2495
2496 // Setup a sprite if none is defined.
2497 if (Object.keys(self._sprite).length === 0) {
2498 self._sprite = {__default: [0, self._duration * 1000]};
2499 }
2500
2501 // Fire the loaded event.
2502 if (self._state !== 'loaded') {
2503 self._state = 'loaded';
2504 self._emit('load');
2505 self._loadQueue();
2506 }
2507 };
2508
2509 /**
2510 * Setup the audio context when available, or switch to HTML5 Audio mode.

Callers 2

loadBufferFunction · 0.85
successFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected