Sounds should still get loaded from storage even if there is not an audio engine present. This is analagous to costumes getting loaded even if there is no renderer present.

This commit is contained in:
Karishma Chadha 2018-04-11 10:28:22 -04:00
parent 6f3c84bf77
commit 6c538d0659

View file

@ -12,6 +12,10 @@ const log = require('../util/log');
*/
const loadSoundFromAsset = function (sound, soundAsset, runtime) {
sound.assetId = soundAsset.assetId;
if (!runtime.audioEngine) {
log.error('No audio engine present; cannot load sound asset: ', sound.md5);
return Promise.resolve(sound);
}
return runtime.audioEngine.decodeSound(Object.assign(
{},
sound,
@ -35,10 +39,6 @@ const loadSound = function (sound, runtime) {
log.error('No storage module present; cannot load sound asset: ', sound.md5);
return Promise.resolve(sound);
}
if (!runtime.audioEngine) {
log.error('No audio engine present; cannot load sound asset: ', sound.md5);
return Promise.resolve(sound);
}
const idParts = StringUtil.splitFirst(sound.md5, '.');
const md5 = idParts[0];
const ext = idParts[1].toLowerCase();