本文整理了Java中javax.sound.sampled.Clip.isOpen()
方法的一些代码示例,展示了Clip.isOpen()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Clip.isOpen()
方法的具体详情如下:
包路径:javax.sound.sampled.Clip
类名称:Clip
方法名:isOpen
暂无
代码示例来源:origin: de.dfki.mary/marytts-client
private void playAudio() {
assert clip != null && clip.isOpen();
clip.start();
}
代码示例来源:origin: stackoverflow.com
protected synchronized void play(Clip clip){
try{
if(clip.isOpen()){
System.out.println("clip is opened...");
clip.start();
clip.setMicrosecondPosition(0); //like rewinding the clip
try {Thread.sleep(10);}
catch (Exception e) {}
}
System.out.println("shooting");
}
catch(Exception e){e.printStackTrace();}
}
代码示例来源:origin: stackoverflow.com
static String randomName = "TreasureQuest";
public static Clip clip = null;
public static void playSound(String name) throws Exception{
if (clip != null && clip.isOpen()) clip.close();
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(new File("music/" + name + ".wav").getAbsoluteFile());
clip = AudioSystem.getClip();
clip.open(audioInputStream);
FloatControl gainControl =
(FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
gainControl.setValue(0f);
System.out.println(clip.getFrameLength() + " | " + clip.getFramePosition());
clip.start();
}
代码示例来源:origin: de.dfki.mary/marytts-client
currentAudio = AudioSystem.getAudioInputStream(new ByteArrayInputStream(bytes));
if (currentAudio == null && (clip == null || !clip.isOpen())) {
bPlay.setEnabled(false);
throw new Exception("No audio data to play (did synthesis succeed?)");
if (clip != null && clip.isOpen())
closeClip();
代码示例来源:origin: stackoverflow.com
if(clip.isOpen()) clip.close();
内容来源于网络,如有侵权,请联系作者删除!