I’m working on a game for flash targets, and I stumbled upon the problem of lag when I try to play a sound that was already loaded into the class way before. So the game runs fine, but as soon as it has to play the (loaded) sound, it lags for about half a second.
My guess is that it has to do with the size of all my assets and rearranging or rebuffering in the ram memory.
Anyways, are there any solutions to this problem you guys know of?
Does this only happen the first time sound is played? I think there might also be a delay when Flash boots up audio support for the first time, it can start with audio disabled, and end up having to enable and initialize support when it realizes later that you need to play a sound
It happens when a specific sound is played for the first time or wasn’t played in a while. That’s why my guess is that it has to do with the ram.
There is a constant background music playing, so it doesn’t have to do with starting to play sound. Although there is indeed a delay in playing the first sound as well.
I wonder though, since the sounds aren’t played that much later, if it’s possible to not let them influence the frame rate? The game now tries to do everything in a single frame…
We don’t have much control over Flash Player, does the
Sound instance remain between plays? I think the
openfl.Assets class caches sound by default now