!7 import static x30_pkg.x30_util.VF1; sclass QuickAudioRecord > DynPrintLog { transient volatile L recording; transient JButton btn; transient bool stop; visualize { //btn = jbutton("Record [hold button down]"); btn = jImageAndTextButton(#1101400, "Record [hold button down]"); onMouseDown(btn, r { stop = false; print("Recording!"); recording = synchroList(); updatePrintLog(); }); onMouseUp(btn, r { set stop }); ret northAndCenterWithMargins(btn, super.visualize()); } start { dm_addAudioListener(voidfunc(short[] data) { temp enter(); final L l = recording; if (l == null) ret; l.add(cloneShortArray(data)); if (stop) { stop = false; recording = null; thread "Save WAV" { temp enter(); print("Recording done. Got " + l(l) + " chunks"); File wavFile = anonymousWAVEFile(); multiShortArraysToWAVE(l, wavFile); printFileInfo(wavFile); vmBus_send('newRecording, wavFile); } } }); } }