java类javax.sound.sampled.DataLine.Info的实例源码

AudioFilePlayer.java 文件源码 项目:TheConsole_POC 阅读 25 收藏 0 点赞 0 评论 0
public void playSync(String filePath) {
    final File file = new File(filePath);

    try (final AudioInputStream in = getAudioInputStream(file)) {
        final AudioFormat outFormat = getOutFormat(in.getFormat());
        final Info info = new Info(SourceDataLine.class, outFormat);

        try (final SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info)) {
            if (line != null) {
                line.open(outFormat);
                line.start();
                stream(getAudioInputStream(outFormat, in), line);
                line.drain();
                line.stop();
            }
        }
    }
    catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
MusicPlayer.java 文件源码 项目:harmonic-moon 阅读 29 收藏 0 点赞 0 评论 0
public void play(InputStream inputStream) {
    stopAll();
    try (final AudioInputStream in = getAudioInputStream(inputStream)) {
        final AudioFormat outFormat = getOutFormat(in.getFormat());
        final Info info = new Info(SourceDataLine.class, outFormat);
        try (final SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info)) {
            if (line != null) {
                lines.add(line);
                line.open(outFormat);
                line.start();
                stream(getAudioInputStream(outFormat, in), line);
                line.drain();
                line.stop();
            }
        }
    } catch (UnsupportedAudioFileException
            | LineUnavailableException
            | IOException exception) {
        throw new IllegalStateException(exception);
    }
}
SourceDataSoundSystem.java 文件源码 项目:runelite 阅读 16 收藏 0 点赞 0 评论 0
@ObfuscatedName("w")
@ObfuscatedSignature(
   signature = "(II)V",
   garbageValue = "-629465154"
)
@Export("create")
protected void create(int var1) throws LineUnavailableException {
   try {
      Info var2 = new Info(SourceDataLine.class, this.audioFormat, var1 << (ContextMenuRow.highMemory?2:1));
      this.source = (SourceDataLine)AudioSystem.getLine(var2);
      this.source.open();
      this.source.start();
      this.size = var1;
   } catch (LineUnavailableException var5) {
      int var4 = (var1 >>> 1 & 1431655765) + (var1 & 1431655765);
      var4 = (var4 >>> 2 & 858993459) + (var4 & 858993459);
      var4 = (var4 >>> 4) + var4 & 252645135;
      var4 += var4 >>> 8;
      var4 += var4 >>> 16;
      int var3 = var4 & 255;
      if(var3 != 1) {
         this.create(class173.nextPowerOfTwo(var1));
      } else {
         this.source = null;
         throw var5;
      }
   }
}
AudioPlayer.java 文件源码 项目:ProfiSounder 阅读 26 收藏 0 点赞 0 评论 0
public AudioPlayer(File audioFile, ResourceBundle messages) throws IOException {
    this.messages = messages;
    try (AudioInputStream in = AudioSystem.getAudioInputStream(audioFile.toURI().toURL())) {
        this.audioFile = audioFile;

        outFormat = getOutFormat(in.getFormat());
        Info info = new Info(SourceDataLine.class, outFormat);

        line = (SourceDataLine) AudioSystem.getLine(info);
        line.open(outFormat);
    } catch (UnsupportedAudioFileException | LineUnavailableException e) {
        throw new IOException(e);
    }
}
OggPlayer.java 文件源码 项目:stupidwarriors 阅读 19 收藏 0 点赞 0 评论 0
public void play(String filePath) {
    final File file = new File(filePath);

    try (final AudioInputStream in = getAudioInputStream(file)) {

        final AudioFormat outFormat = getOutFormat(in.getFormat());
        final Info info = new Info(SourceDataLine.class, outFormat);

        try (final SourceDataLine line =
                 (SourceDataLine) AudioSystem.getLine(info)) {

            if (line != null) {
                line.open(outFormat);
                line.start(); 
                AudioInputStream inputMystream = AudioSystem.getAudioInputStream(outFormat, in);
                stream(inputMystream, line);
                line.drain();
                line.stop();  
            }
        }

    } catch (UnsupportedAudioFileException 
           | LineUnavailableException 
           | IOException e) {
        throw new IllegalStateException(e);
    }
}
JavaSoundInDevice.java 文件源码 项目:frinika 阅读 19 收藏 0 点赞 0 评论 0
public JavaSoundInDevice(Mixer mixer, AudioFormat af, Info info,int bufferSizeInFrames) {
    super(mixer, af, info,bufferSizeInFrames);
    framesRead = 0;
    doFlush = true;
}
JavaSoundOutDevice.java 文件源码 项目:frinika 阅读 18 收藏 0 点赞 0 评论 0
public JavaSoundOutDevice(Mixer mixer, AudioFormat af, Info info,int bufferSizeInFrames) {
    super(mixer, af, info, bufferSizeInFrames);


}


问题


面经


文章

微信
公众号

扫码关注公众号