From fb6f457605d0b2f24d31117d27cc14b0cd7de79a Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Sun, 26 Feb 2017 15:26:38 -0800 Subject: [PATCH] Fix cache for HTML5 path group --- lime/utils/AssetLibrary.hx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lime/utils/AssetLibrary.hx b/lime/utils/AssetLibrary.hx index 1f4b08c2d..f918e898f 100644 --- a/lime/utils/AssetLibrary.hx +++ b/lime/utils/AssetLibrary.hx @@ -779,6 +779,8 @@ class AssetLibrary { if (type == MUSIC || type == SOUND) { path = paths.get (id); + if (path == null) continue; + soundName = Path.withoutExtension (path); if (!sounds.exists (soundName)) { @@ -836,6 +838,38 @@ class AssetLibrary { private function loadAudioBuffer_onComplete (id:String, audioBuffer:AudioBuffer):Void { cachedAudioBuffers.set (id, audioBuffer); + + #if (js && html5) + var type, path, soundName; + + path = paths.get (id); + + if (path != null) { + + soundName = Path.withoutExtension (path); + + for (otherID in types.keys ()) { + + type = types.get (otherID); + + if (type == MUSIC || type == SOUND) { + + path = paths.get (otherID); + if (path == null) continue; + + if (soundName == Path.withoutExtension (path)) { + + cachedAudioBuffers.set (otherID, audioBuffer); + + } + + } + + } + + } + #end + __assetLoaded (id); }