!7 static JButton button; static volatile Capturer cap; p-substance { showControls(jCenteredLine(button = jbutton("Record!", f recordOrStop))); } svoid recordOrStop { if (cap != null) { cap.stop(); byte[] pcm = cap.getPCM(); infoMessage("Got " + l(pcm) + " bytes PCM!"); cap = null; setText(button, "Record!"); } else { AudioLine line = first(allTargetDataLines()); assertNotNull("Need audio input line!", line); DataLine dataLine = cast line.open(); print("Capturing"); cap = captureAudioFromLine2(dataLine, sphinxAudioFormat()); setText(button, "Stop"); } }