final int bufSize = 16384; SourceDataLine line; Thread thread; Socket s;
Playback(Socket s){//构造器 取得socket以获得网络输入流 this.s=s; } public void start() {
thread = new Thread(this); thread.setName("Playback"); thread.start(); }
public void stop() { thread = null; }
public void run() {
AudioFormat format =new AudioFormat(8000,16,2,true,true);//AudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian) BufferedInputStream playbackInputStream;
AudioFormat format =new AudioFormat(8000,16,2,true,true);//AudioFormat(float sampleRate, int sampleSizeInBits, int channels, boolean signed, boolean bigEndian) DataLine.Info info = new DataLine.Info(TargetDataLine.class,format);