mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 07:22:33 -05:00
Audio engine decodes sounds
This commit is contained in:
parent
2303a1abc5
commit
1ec1165905
1 changed files with 5 additions and 1 deletions
|
@ -226,11 +226,15 @@ var loadSound = function (sound, runtime) {
|
||||||
log.error('No storage module present; cannot load sound asset: ', sound.md5);
|
log.error('No storage module present; cannot load sound asset: ', sound.md5);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!runtime.audioEngine) {
|
||||||
|
log('No audio engine present; cannot load sound asset: ', sound.md5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var idParts = sound.md5.split('.');
|
var idParts = sound.md5.split('.');
|
||||||
var md5 = idParts[0];
|
var md5 = idParts[0];
|
||||||
runtime.storage.load(AssetType.Sound, md5).then(function (soundAsset) {
|
runtime.storage.load(AssetType.Sound, md5).then(function (soundAsset) {
|
||||||
sound.data = soundAsset.data;
|
sound.data = soundAsset.data;
|
||||||
// @todo register sound.data with scratch-audio
|
runtime.audioEngine.decodeSound(sound);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue