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

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

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

Clip.getFramePosition介绍

暂无

代码示例

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

public void run() {
    System.err.println("Timer task running");
    if (!clip.isActive() // already stopped?
        || clip.getFramePosition() >= endFrame) {
      System.err.println("Timer task stopping clip.");
      clip.stop();
      this.cancel();
    }
  }
}

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

public void run() {
    System.err.println("Timer task running");
    if (!clip.isActive() // already stopped?
        || clip.getFramePosition() >= endFrame) {
      System.err.println("Timer task stopping clip.");
      clip.stop();
      this.cancel();
    }
  }
}

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

Clip[] myBunchOfClipsToPlaySequentially=new Clip[A_BUNCH];
//
// [load actual clips...]
// [...]
//
for(Clip c: myBunchOfClipsToPlaySequentially)
  while(c.getFramePosition()<c.getFrameLength())
    Thread.yield(); // Note that if we simply put a NO-OP instead (like a
            // semicolon or a {}), we make Jesus cry (and our CPU
            // too). Thread.yield() allows for almost 0% CPU consumption.

代码示例来源: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: net.sf.mmax2/mmax2

while(true)
  currentFramePos = ((Clip) line).getFramePosition();
  if (currentFramePos<lastFramePos)

相关文章