player.java

来自「用Java编写的一个可下载MP3」· Java 代码 · 共 31 行

JAVA
31
字号
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package org.serain.shmily.ztest;import java.io.*;import javax.sound.sampled.*;import javazoom.jl.decoder.*;/** * * @author phoenix */public class player {    public static void main(String[]args) throws Exception{        Decoder decoder=new Decoder();        FileInputStream fis = new FileInputStream(new File(""));        InputStream is=new BufferedInputStream(fis);        Bitstream bitstream=new Bitstream(is);       // AudioInputStream ais= AudioSystem.getAudioInputStream(bitstream);        AudioFormat format=new AudioFormat(decoder.getOutputFrequency(),16,decoder.getOutputChannels(),true, false);        DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);        Line line = AudioSystem.getLine(info);        SourceDataLine source = (SourceDataLine)line;        source.start();    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?