From dad76201f50b204219f13747d45d02626e8e9e55 Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Sat, 2 Aug 2025 19:40:23 +0700 Subject: [PATCH] use static music if possible --- source/openfl/utils/Assets.hx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/openfl/utils/Assets.hx b/source/openfl/utils/Assets.hx index f0c47e83..c14b9f2c 100644 --- a/source/openfl/utils/Assets.hx +++ b/source/openfl/utils/Assets.hx @@ -243,6 +243,10 @@ class Assets public static function getMusic(id:String, useCache:Bool = true, staticFallback:Bool = true):Sound { + if (useCache && staticFallback && cache.enabled && cache.hasSound(id)) { + var sound = cache.getSound(id); + if (isValidSound(sound)) return sound; + } #if (lime_vorbis && lime > "7.9.0" && !macro) if (Options.streamedMusic) { var path = getPath(id);