public void close() throws IOException { if (line.isActive()) { line.flush(); line.stop(); } line.close(); }
public int read(byte[] b, int off, int len) throws IOException { // System.out.print("'"+len+"'"); try { int ret = line.read(b, off, len); // if (ret > 50 && DEBUG_TRANSPORT && !printedBytes) { // printedBytes = true; // out("AudioCapture: first bytes being captured:"); // String s = ""; // for (int i = 0; i < 50; i++) { // s += " " + b[i]; // } // out(s); // } if (isMuted()) { muteBuffer(b, off, ret); } // run some simple analysis if (ret > 0) { calcCurrVol(b, off, ret); } return ret; } catch (IllegalArgumentException e) { throw new IOException(e.getMessage()); } }
protected void openLineImpl() throws Exception { TargetDataLine tdl = (TargetDataLine) line; tdl.open(lineFormat, bufferSize); ais = new TargetDataLineMeter(tdl); ais = AudioSystem.getAudioInputStream(netFormat, ais); }
public int available() throws IOException { return line.available(); }
TargetDataLineMeter(TargetDataLine line) { super(new ByteArrayInputStream(new byte[0]), line.getFormat(), AudioSystem.NOT_SPECIFIED); this.line = line; }