I'm making an application that begins recording once it receives an audio signal above a threshold and ends recording once that falls below the threshold for a few seconds straight. I have set a maximum recording length to 5 minutes consecutively so that it doesn't run out of memory, yet after several recordings (last crash was 10 recordings x 5 minutes each) I get an OutOfMemoryError as it writes to the saved file.
Here is the error (minus the Processing added part):
Exception in thread "Animation Thread" java.lang.OutOfMemoryError: Java heap space
at org.tritonus.share.sampled.FloatSampleBuffer.convertToByteArray(FloatSampleBuffer.java:394)
at ddf.minim.javasound.JSBufferedSampleRecorder.save(JSBufferedSampleRecorder.java:144)
at ddf.minim.AudioRecorder.save(AudioRecorder.java:107)
at AOVAudioRecord.completeRecord(AOVAudioRecord.java:213)
at AOVAudioRecord.draw(AOVAudioRecord.java:136)
at processing.core.PApplet.handleDraw(PApplet.java:1606)
I can post all of the code if that helps. It seems clear its from saving the file, which is maxed out at 5 minutes in length, and only happens after it has recorded around 50 minutes worth... any suggestions for how I can fix this? I need this to run for 10 days straight
I am building a library of display objects. Each display object has access to the running PApplet reference. How can I determine what graphics mode PApplet is using (i.e. OpenGL, P3D, Java2D)?
I've tried PApplet's getGraphics() method but applet's running in OpenGL are returning "sun.java2d.SunGraphics2D[font=java.awt.Font[family=Lucida Grande,name=Lucida Grande,style=plain,size=13],color=java.awt.Color[r=0,g=0,b=0]]"