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

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

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

Clip.setLoopPoints介绍

暂无

代码示例

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

public void setLoopPoints(int start, int end)
{
  c.setLoopPoints( start, end );
}

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

private void playBackClip(String fileName) {
  try {
    AudioInputStream soundStream = null;
    if (fileName.startsWith("res:")) {
      soundStream = AudioSystem.getAudioInputStream(
        Object.class.getResourceAsStream(fileName.substring(4)));
    } else {
      File audioFile = resMap.get(fileName);
      soundStream = AudioSystem.getAudioInputStream(audioFile);
    }
    AudioFormat streamFormat = soundStream.getFormat();
    DataLine.Info clipInfo = new DataLine.Info(Clip.class,
        streamFormat);

    Clip clip = (Clip) AudioSystem.getLine(clipInfo);
    soundClip = clip;
    clip.open(soundStream);
    clip.setLoopPoints(0, -1);
    clip.start();
  } catch (UnsupportedAudioFileException e) {
    e.printStackTrace();
  } catch (IOException e) {
    e.printStackTrace();
  } catch (LineUnavailableException e) {
    e.printStackTrace();
  }
}

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

...
   Clip clip = (Clip) AudioSystem.getLine(info);
   clip.open(af, audio, 0, size);
   clip.loop(3); //Added this line
   clip.setLoopPoints(0, -1); //Added this line
   clip.start();
   ...

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

@Override
boolean  startSample(int loopCount, float gain, int delay) {
/*
  if (debugFlag) {
    debugPrint("JSClip: startSample ");
    debugPrintln("start stream called with ");
    debugPrintln("       gain = " + gain + ", delay is zero");
  }
// Since only one sample is processed in startSample, just call
// this more general method passing duplicate information
// We don't really want to do this in the long term.
  return startSamples(loopCount, gain, gain, 0, 0);
*/
// TODO: The following is temporary until we have fully
// functional startSample and startSamples methods
if (debugFlag)
  debugPrintln("JSClip.startSample(): starting sound Clip");
line.setFramePosition(0); // Start playing from the beginning
line.setLoopPoints(0, -1); // Loop the entire sound sample
line.loop(loopCount);
line.start();
return true;
}  // end of start (single) Sample

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

line.setLoopPoints(0, -1);	// Loop the entire sound sample

相关文章