Open bigboss97 opened 1 year ago
Thanks for your report, could you maybe try downloading this library test build (just extract it into your Arduino/libraries folder) and make sure you explicitly call firstfile.stop()
before all of your other garbage collection steps and let me know if that helps? The same gc issue is what underlies #74 so it would be great to get some grip on this...
Thanks for your quick response. I've created following test sketch and it worked great:
import android.os.Environment;
import processing.sound.*;
final String androidRoot= new String( Environment.getExternalStorageDirectory().getAbsolutePath());
SoundFile music;
String song1= androidRoot+"/myHome/Music/English/Beat it - Michael Jackson.mp3";
String song2= androidRoot+"/myHome/Music/English/Beep - The Pussycat Dolls.mp3";
void setup() {
while( true) {
println("Load 1");
music= new SoundFile( this, song1);
music.play();
println("Playing 1");
delay(5000);
music.stop();
music.removeFromCache();
music= null;
println("Cleaned 1");
println("Load 2");
music= new SoundFile( this, song2);
music.play();
println("Playing 2");
delay(5000);
music.stop();
music.removeFromCache();
music= null;
println("Cleaned 2");
}
}
Unfortunately, it's still crashing in my program. I guess it's because of the variable scope. I use the SoundFile in a class. Maybe it doesn't get cleaned up as long as the object is still around. I'll work around this and use a global variable.
Hi, I have: similar issue
I'm using Processing 4.1.1 in Android mode. I've downloaded the latest library from here and it works much better than the built-in one. Now I can open larger song and run it in correct speed. Thanks for the fix.
I'm currently facing an issue. I can't load next song because it runs out of memory. I tried to use removeFromCache(), assign null to my SoundFile and do System.gc(). Nothing helped.
My question, is there a way to force a memory release before I create the next SoundFile?