Audio engine decodes sounds

This commit is contained in:
Eric Rosenbaum 2017-03-22 18:12:04 -04:00
parent 2303a1abc5
commit 1ec1165905

View file

@ -226,11 +226,15 @@ var loadSound = function (sound, runtime) {
log.error('No storage module present; cannot load sound asset: ', sound.md5);
return;
}
if (!runtime.audioEngine) {
log('No audio engine present; cannot load sound asset: ', sound.md5);
return;
}
var idParts = sound.md5.split('.');
var md5 = idParts[0];
runtime.storage.load(AssetType.Sound, md5).then(function (soundAsset) {
sound.data = soundAsset.data;
// @todo register sound.data with scratch-audio
runtime.audioEngine.decodeSound(sound);
});
};