-
-
Notifications
You must be signed in to change notification settings - Fork 935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flame.audio performance issues #34
Comments
Hi, @JamesMudge , thanks for your feedback! If you are playing audios on that high frequency, you probably should consider using an AudioPool, instead of Flame.audio. Creating and buffering audioplayers instances is indeed very, very expensive. There is nothing you can do, other than preload everything before you use it. Could you please test that and see if the results are better? |
I should have noted that I am using Flame.audio.loadAll([...]) to pre cache all the sounds well before I try to use them. |
Using AudioPool does improve this situation greatly. For anybody who ends up here is what you're looking for: // in a global place // will play once the sound specified, very quickly, you can repeat up to 2 times simultaneously very quicky. if you request more, it will create a third player and so on, but it might take longer, and those extra players will be disposed later and make sure you import 'package:flame/audio_pool.dart'; |
Calls to Flame.audio.play() have a high performance impact.
I lose 5-15 frames making as few as two calls per second on a physical android s5.
The text was updated successfully, but these errors were encountered: