javax.sound.sampled.Clip.close()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(126)

本文整理了Java中javax.sound.sampled.Clip.close()方法的一些代码示例,展示了Clip.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Clip.close()方法的具体详情如下:
包路径:javax.sound.sampled.Clip
类名称:Clip
方法名:close

Clip.close介绍

暂无

代码示例

代码示例来源:origin: marytts/marytts

/**
 * Stop wav play back
 * 
 */
public static void stopWavFile() {
  m_clip.stop();
  m_clip.flush();
  m_clip.close();
}

代码示例来源:origin: marytts/marytts

/**
 * Stop wav play back
 * 
 */
public static void stopWavFile() {
  m_clip.stop();
  m_clip.flush();
  m_clip.close();
}

代码示例来源:origin: RipMeApp/ripme

/**
 * Plays a sound from a file.
 *
 * @param filename Path to the sound file
 */
public static void playSound(String filename) {
  URL resource = ClassLoader.getSystemClassLoader().getResource(filename);
  try {
    final Clip clip = (Clip) AudioSystem.getLine(new Line.Info(Clip.class));
    clip.addLineListener(event -> {
      if (event.getType() == LineEvent.Type.STOP) {
        clip.close();
      }
    });
    clip.open(AudioSystem.getAudioInputStream(resource));
    clip.start();
  } catch (Exception e) {
    LOGGER.error("Failed to play sound " + filename, e);
  }
}

代码示例来源:origin: tomighty/tomighty

private void closeClip() {
  Clip clip = activeClips.get(sound);
  clip.close();
  activeClips.remove(sound);
}

代码示例来源:origin: ddf/Minim

public void close()
{
  c.close();
}

代码示例来源:origin: playn/playn

@Override
protected void releaseImpl() {
 impl.close();
}

代码示例来源:origin: robo-code/robocode

private void dispose() {
  for (Clip c : clips) {
    c.close();
  }
}

代码示例来源:origin: threerings/playn

@Override
protected void releaseImpl() {
 impl.close();
}

代码示例来源:origin: de.dfki.mary/marytts-client

private void closeClip() {
  // workaround for a bug in Linux-based Java VM from Sun:
  if (!(System.getProperty("java.vendor").equals("Sun Microsystems Inc.") && System.getProperty("os.name").equals("Linux"))) {
    clip.close();
  }
}

代码示例来源:origin: stackoverflow.com

final Clip clip = AudioSystem.getClip();
// Configure clip: clip.open();
clip.start();

clip.addLineListener(new LineListener() {
  @Override
  public void update(LineEvent event) {
    if (event.getType() == LineEvent.Type.STOP)
      clip.close();
  }
});

代码示例来源:origin: ru.sbtqa/monte-media

public synchronized void stop() {
  if (clip != null) {
    clip.stop();
    clip.close();
    clip = null;
  }
}

代码示例来源:origin: chatty/chatty

@Override
  public void update(LineEvent event) {
    LOGGER.info("LineEvent: "+event);
    if (event.getType() == LineEvent.Type.STOP) {
      clip.close();
    }
  }
});

代码示例来源:origin: Multibit-Legacy/multibit-hd

@Override
 public void update(LineEvent event) {
  if (event.getType() == LineEvent.Type.STOP)
   clip.close();
 }
});

代码示例来源:origin: redomar/JavaGame

public void close(){
  stop();
  clip.close();
}

代码示例来源:origin: nroduit/Weasis

public void dispose() {
  if (series != null) {
    closingSeries(series);
    series = null;
  }
  if (clip != null) {
    clip.close();
  }
}

代码示例来源:origin: stackoverflow.com

final Clip clip = AudioSystem.getClip();
clip.addLineListener(new LineListener() {
  @Override
  public void update(LineEvent event) {
    if (event.getType() == LineEvent.Type.STOP)
      clip.close();
  }
});

代码示例来源:origin: stackoverflow.com

AudioInputStream ais = 
   AudioSystem.getAudioInputStream(getClass().getResource("/information.wav"));
Clip clip = AudioSystem.getClip();
clip.open(ais);
clip.start();            
JOptionPane.showMessageDialog(...);
clip.close();

代码示例来源:origin: jcgay/maven-notifier

private void playAndWait(Clip clip, EndListener listener) {
  try {
    clip.start();
    listener.waitEnd();
  } catch (InterruptedException e) {
    Thread.currentThread().interrupt();
  } finally {
    clip.close();
  }
}

代码示例来源:origin: org.jvnet.hudson/netx

/**
 * Stops playing the clip and disposes it; the clip cannot be
 * played after being disposed.
 */
void dispose() {
  if (clip != null) {
    clip.stop();
    clip.flush();
    clip.close();
  }
  clip = null;
}

代码示例来源:origin: org.scijava/j3dutils

public void update(LineEvent event) {
  if (event.getType().equals(LineEvent.Type.STOP)) {
    line.close(); // really a stop??
  }
  else if (event.getType().equals(LineEvent.Type.CLOSE)) {
    // this forces a system exit in example code
    // TODO: what should be done to close line
    if (debugFlag)
      debugPrint("JSClip.update(CLOSE) entered ");
  }
}

相关文章