コード例 #1
0
 public void handleApplicationClose() {
   try {
     recorder.stop();
     speechToTextTransformer.stop();
   } catch (InterruptedException e) {
     e.printStackTrace();
   }
 }
コード例 #2
0
 @FXML
 private void handleRecording() {
   if (recordingOn) {
     recordingOn = false;
     imageView.setImage(null);
     recordingButton.setText("Start Recording");
     appendToProtocol("... recording stopped");
     try {
       recorder.stop();
       speechToTextTransformer.stop();
     } catch (InterruptedException e) {
       appendToProtocol("error stopping recorder");
       e.printStackTrace();
     }
   } else {
     recordingOn = true;
     imageView.setImage(recordingImage);
     recordingButton.setText("Stop Recording");
     int timesInSeconds = new Double(slider.getValue()).intValue();
     appendToProtocol("start recording (" + timesInSeconds + "s chunks)...");
     recorder.start(timesInSeconds);
     speechToTextTransformer.start();
   }
 }