static int captureAudioFromLine3_bufSize = 65536; // uses default line static void captureAudioFromLine3(AudioFormat format, OutputStream out, Flag stop) ctex { AudioLine line = first(allTargetDataLines()); assertNotNull("Need audio input line!", line); DataLine dataLine = cast line.open(); captureAudioFromLine3(dataLine, format, out, stop); } static void captureAudioFromLine3(DataLine line, AudioFormat format, OutputStream out, Flag stop) ctex { if (!line instanceof TargetDataLine) fail(getClassName(line)); TargetDataLine tdl = cast line; tdl.open(format); tdl.start(); int n; byte[] buf = new byte[captureAudioFromLine3_bufSize]; while (licensed() && !stop.isUp() && (n = tdl.read(buf, 0, l(buf))) > 0) { out.write(buf, 0, n); } tdl.close(); }