Skip to content
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

How to properly close and release resource? #13

Open
amuhaimin02 opened this issue Jun 9, 2020 · 1 comment
Open

How to properly close and release resource? #13

amuhaimin02 opened this issue Jun 9, 2020 · 1 comment

Comments

@amuhaimin02
Copy link

Hello, good day!

I have been developing a little app (for Android) which uses flutter_midi. Basically the app will allow the user to input notes and play them back,similar to an audio sequencer.

Then one night after developing and testing, I left the app minimized from background (Pressing the home button). The next day, the phone battery level dropped hard and the phone overheats a little. Ultimately I found that the problem is caused by my app.

Upon further research, and by checking the battery graph, I found that my phone is awake at all times. I used Wakelock Detector app to confirm what caused the phone to be in that state, and found that my app is responsible for that. The app has been in CPU Wakelock overnight, consuming and battery.

Then I found that the app process that caused that is called "AudioMix", I suspect that the app is not closed properly due to the audio playback. Even the audio have been stopped playing, the process still keeps running until I eventually closed my app either by force stopping or swiping up from recent apps.

I tried to find a way to make the app to release all possible resource programmatically. However I cannot find that in the flutter_midi documentation. Can only find play_midi_note and stop_midi_note function. Even the stop function cannot completely stop the playback from running

Is there a way to completely close flutter_midi to free up the resource?

TIA

@rodydavis
Copy link
Owner

If this is android i wouldnt be surprised if that was the case. Im using the built in audio engine.

The plugin is currently being refactored to do more in dart and not relay on these built in synths and we can control disposing better. Stay tuned, should have new info soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants