public void stopRecording() { line.stop(); }
/** * Stops the thread. This method does not return until recording has actually stopped, and all the data has been * read from the audio line. */ public void stopRecording() { audioLine.stop(); try { synchronized (lock) { while (!done) { lock.wait(); } } } catch (InterruptedException e) { e.printStackTrace(); } // flush can not be called here because the audio-line might has been set to null already by the mic-thread // audioLine.flush(); }
public void stopRecordingNOW() { // don't drain, whatever data is in the buffer will not be retained m_line.stop(); m_line.close(); m_bRecording = false; }
public void stopRecordingNOW() { // don't drain, whatever data is in the buffer will not be retained m_line.stop(); m_line.close(); m_bRecording = false; }
public void stopRecordingNOW() { // don't drain, whatever data is in the buffer will not be retained m_line.stop(); m_line.close(); m_bRecording = false; }
public void stopRecordingNOW() { // don't drain, whatever data is in the buffer will not be retained m_line.stop(); m_line.close(); m_bRecording = false; }
/** * Stops the recording. * * Note that stopping the thread explicitely is not necessary. Once no more data can be read from the TargetDataLine, no more * data be read from our AudioInputStream. And if there is no more data from the AudioInputStream, the method * 'AudioSystem.write()' (called in 'run()' returns. Returning from 'AudioSystem.write()' is followed by returning from * 'run()', and thus, the thread is terminated automatically. * * It's not a good idea to call this method just 'stop()' because stop() is a (deprecated) method of the class 'Thread'. And * we don't want to override this method. */ public void stopRecording() { m_line.stop(); m_line.close(); }
/** * Stops the recording. * * Note that stopping the thread explicitely is not necessary. Once no more data can be read from the TargetDataLine, no more * data be read from our AudioInputStream. And if there is no more data from the AudioInputStream, the method * 'AudioSystem.write()' (called in 'run()' returns. Returning from 'AudioSystem.write()' is followed by returning from * 'run()', and thus, the thread is terminated automatically. * * It's not a good idea to call this method just 'stop()' because stop() is a (deprecated) method of the class 'Thread'. And * we don't want to override this method. */ public void stopRecording() { m_line.stop(); m_line.close(); }
/** * Stops the recording. * * Note that stopping the thread explicitely is not necessary. Once no more data can be read from the TargetDataLine, no more * data be read from our AudioInputStream. And if there is no more data from the AudioInputStream, the method * 'AudioSystem.write()' (called in 'run()' returns. Returning from 'AudioSystem.write()' is followed by returning from * 'run()', and thus, the thread is terminated automatically. * * It's not a good idea to call this method just 'stop()' because stop() is a (deprecated) method of the class 'Thread'. And * we don't want to override this method. */ public void stopRecording() { m_line.stop(); m_line.close(); }
/** * Stops the recording. * * Note that stopping the thread explicitely is not necessary. Once no more data can be read from the TargetDataLine, no more * data be read from our AudioInputStream. And if there is no more data from the AudioInputStream, the method * 'AudioSystem.write()' (called in 'run()' returns. Returning from 'AudioSystem.write()' is followed by returning from * 'run()', and thus, the thread is terminated automatically. * * It's not a good idea to call this method just 'stop()' because stop() is a (deprecated) method of the class 'Thread'. And * we don't want to override this method. */ public void stopRecording() { m_line.stop(); m_line.close(); }
/** * Stops the recording. * * Note that stopping the thread explicitely is not necessary. Once no more data can be read from the TargetDataLine, no more * data be read from our AudioInputStream. And if there is no more data from the AudioInputStream, the method * 'AudioSystem.write()' (called in 'run()' returns. Returning from 'AudioSystem.write()' is followed by returning from * 'run()', and thus, the thread is terminated automatically. * * It's not a good idea to call this method just 'stop()' because stop() is a (deprecated) method of the class 'Thread'. And * we don't want to override this method. */ public void stopRecording() { m_line.stop(); m_line.close(); }
/** * Stops the recording. * * Note that stopping the thread explicitely is not necessary. Once no more data can be read from the TargetDataLine, no more * data be read from our AudioInputStream. And if there is no more data from the AudioInputStream, the method * 'AudioSystem.write()' (called in 'run()' returns. Returning from 'AudioSystem.write()' is followed by returning from * 'run()', and thus, the thread is terminated automatically. * * It's not a good idea to call this method just 'stop()' because stop() is a (deprecated) method of the class 'Thread'. And * we don't want to override this method. */ public void stopRecording() { m_line.stop(); m_line.close(); }
/** * Stops the recording. * * Note that stopping the thread explicitely is not necessary. Once no more data can be read from the TargetDataLine, no more * data be read from our AudioInputStream. And if there is no more data from the AudioInputStream, the method * 'AudioSystem.write()' (called in 'run()' returns. Returning from 'AudioSystem.write()' is followed by returning from * 'run()', and thus, the thread is terminated automatically. * * It's not a good idea to call this method just 'stop()' because stop() is a (deprecated) method of the class 'Thread'. And * we don't want to override this method. */ public void stopRecording() { m_line.stop(); m_line.close(); }
/** * Stops the recording. * * Note that stopping the thread explicitely is not necessary. Once no more data can be read from the TargetDataLine, no more * data be read from our AudioInputStream. And if there is no more data from the AudioInputStream, the method * 'AudioSystem.write()' (called in 'run()' returns. Returning from 'AudioSystem.write()' is followed by returning from * 'run()', and thus, the thread is terminated automatically. * * It's not a good idea to call this method just 'stop()' because stop() is a (deprecated) method of the class 'Thread'. And * we don't want to override this method. */ public void stopRecording() { m_line.stop(); m_line.close(); }
public void stopRecording() { m_line.drain(); m_line.stop(); m_line.close(); m_bRecording = false; }
public void stopRecording() { m_line.drain(); m_line.stop(); m_line.close(); m_bRecording = false; }
public void stopRecording() { m_line.drain(); m_line.stop(); m_line.close(); m_bRecording = false; }
public void stopRecording() { m_line.drain(); m_line.stop(); m_line.close(); m_bRecording = false; }
@Override public void run() { byte[] data = new byte[microphone.getBufferSize()]; out = new ByteArrayOutputStream(); try { microphone.flush(); microphone.start(); while (!done) { int numBytesRead = microphone.read(data, 0, data.length); if (numBytesRead != -1) { out.write(data, 0, numBytesRead); } else { break; } } microphone.stop(); out.flush(); } catch (IOException e) { e.printStackTrace(); } synchronized (lock) { lock.notify(); } } }
if (estimatedTime > 60000) { // 60 seconds System.out.println("Stop speaking."); targetDataLine.stop(); targetDataLine.close(); break;