Exemple #1
0
 public void playResource(String resourceName) {
   InputStream in = (getClass().getClassLoader().getResourceAsStream(resourceName));
   if (in != null) {
     try {
       AudioInputStream ais = AudioSystem.getAudioInputStream(new BufferedInputStream(in));
       play(ais);
     } catch (Exception e) {
       LOG.error(e);
     }
   } else {
     LOG.debug("[playResource] can't find resource named: {0}", resourceName);
   }
 }
 protected void playResult(String id) {
   //        Long lid = Long.valueOf(id);
   if ("-1".equals(id)) {
     AudioManagerFactory.createAudioManager()
         .play(
             getTargetWavURL(),
             (getTargetMarker().getStart().floatValue() / 1000),
             (getTargetMarker().getLength().floatValue() / 1000));
   }
   for (RecognitionResult recognitionResult : results) {
     if (recognitionResult.getInfo().getId().equals(id)) {
       try {
         AudioManagerFactory.createAudioManager()
             .play((new File(recognitionResult.getDetails().getAudioFilePath()).toURI().toURL()));
         break;
       } catch (MalformedURLException ex) {
         log.error(ex);
         throw new ProcessingException(ex);
       }
     }
   }
 }