I tried to add sound to the game, but got a problem.
If a function that requires a lot of processor resources is working during music playback, then the sound lags. I have no idea how to solve this. Is it possible to add asynchrony here? Or limit the function? This happens not only with sound, the whole game freezes. But with sound, this is most noticeable.
A simple example below.
Function calc() calculates the sum of primes. Found it on the Internet. The main thing is the demanding function.Simple project.zip (8.9 MB)
This is because built in audio is not played on its own thread currently. You can use either of these depending on your feature needs. extension-openal would be faster to use but defold-fmod has way more features posible.