Esempio n. 1
0
 public void close() throws IOException {
   if (line.isActive()) {
     line.flush();
     line.stop();
   }
   line.close();
 }
Esempio n. 2
0
 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());
   }
 }
Esempio n. 3
0
 protected void openLineImpl() throws Exception {
   TargetDataLine tdl = (TargetDataLine) line;
   tdl.open(lineFormat, bufferSize);
   ais = new TargetDataLineMeter(tdl);
   ais = AudioSystem.getAudioInputStream(netFormat, ais);
 }
Esempio n. 4
0
 public int available() throws IOException {
   return line.available();
 }
Esempio n. 5
0
 TargetDataLineMeter(TargetDataLine line) {
   super(new ByteArrayInputStream(new byte[0]), line.getFormat(), AudioSystem.NOT_SPECIFIED);
   this.line = line;
 }