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

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

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

Clip.drain介绍

暂无

代码示例

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

m_clip.drain();
} else {
  System.out.println("playWavFile<init>(): can't get data from file " + clipFile.getName());

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

m_clip.drain();
} else {
  System.out.println("playWavFile<init>(): can't get data from file " + clipFile.getName());

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

URL url = new File("C:/Users/Jack/Desktop/Pok/pokemon.wav").toURI().toURL();
AudioInputStream ais = AudioSystem.getAudioInputStream(url));
Clip clip = AudioSystem.getClip();
clip.open(ais);
clip.start();
clip.drain(); // Stop the main thread from exiting

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

try (InputStream is = new BufferedInputStream(new FileInputStream(SoundPlayer.class.getResourceAsStream(s)))) {
  AudioInputStream audioStream = AudioSystem.getAudioInputStream(is);

  AudioFormat format = audioStream.getFormat();
  DataLine.Info info = new DataLine.Info(Clip.class, format);
  Clip clip = (Clip) AudioSystem.getLine(info);
  clip.open(audioStream);
  clip.start();
  try {
    Thread.sleep(250);
  } catch (InterruptedException ex) {

  }
  clip.drain();
} catch (IOException | LineUnavailableException | UnsupportedAudioFileException ex) {
  ex.printStackTrace();
}

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

clip.open(stream);
clip.start();
clip.drain();

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

public static void runOnce(final String location) {
  File audioFile = new File(Game.gameFolder + "/sounds/" + location);
  Thread t = new Thread(new Runnable() {
    public void run() {
      try (AudioInputStream audioStream = AudioSystem
          .getAudioInputStream(audioFile);) {
        AudioFormat format = audioStream.getFormat();
        DataLine.Info info = new DataLine.Info(Clip.class, format);
        try (Clip audioClip = (Clip) AudioSystem.getLine(info);) {
          audioClip.open(audioStream);
          audioClip.start();
          audioClip.drain();
        }
        System.out.println("heyeyeyeyye");
        System.out.println("sound method ran");
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
  });
  t.start();
  t.join();
}

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

public static void main(String[] args) throws IOException,
  UnsupportedAudioFileException, LineUnavailableException
{
  File in = new File("C:\\Users\\Sandra\\Desktop\\music\\rags.wav");
  AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(in);
  Clip play = AudioSystem.getClip();
  play.open(audioInputStream);
  FloatControl volume= (FloatControl) play.getControl(FloatControl.Type.MASTER_GAIN);
  volume.setValue(1.0f); // Reduce volume by 10 decibels.
  play.start();
  play.drain();
  play.close();
}

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

play.drain();
} catch (UnsupportedAudioFileException | IOException | LineUnavailableException ex) {
  ex.printStackTrace();

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

System.out.println("Started");
  clip.drain();
  System.out.println("Drained");
} catch(LineUnavailableException | InterruptedException lue) { lue.printStackTrace(); }

代码示例来源:origin: org.apache.ant/ant-jmf

audioClip.drain();

相关文章