mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 15:02:52 -05:00
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:
parent
6f3c84bf77
commit
6c538d0659
1 changed files with 4 additions and 4 deletions
|
@ -12,6 +12,10 @@ const log = require('../util/log');
|
||||||
*/
|
*/
|
||||||
const loadSoundFromAsset = function (sound, soundAsset, runtime) {
|
const loadSoundFromAsset = function (sound, soundAsset, runtime) {
|
||||||
sound.assetId = soundAsset.assetId;
|
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(
|
return runtime.audioEngine.decodeSound(Object.assign(
|
||||||
{},
|
{},
|
||||||
sound,
|
sound,
|
||||||
|
@ -35,10 +39,6 @@ const 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 Promise.resolve(sound);
|
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 idParts = StringUtil.splitFirst(sound.md5, '.');
|
||||||
const md5 = idParts[0];
|
const md5 = idParts[0];
|
||||||
const ext = idParts[1].toLowerCase();
|
const ext = idParts[1].toLowerCase();
|
||||||
|
|
Loading…
Reference in a new issue