!!!!!!
我自己解决了这个问题(14岁!!),
我写了这个课:
import java.io.IOException;import javax.sound.sampled.AudioInputStream;public class frameBuffer { private byte[][] frames; private int frameSize; public frameBuffer(AudioInputStream stream) throws IOException { readframes(stream); } public byte[] getframe(int i) { return frames[i]; } public int numberframes() { return frames.length; } public int frameSize() { return frameSize; } private void readframes(AudioInputStream stream) throws IOException { frameSize = stream.getFormat().getframeSize(); frames = new byte[stream.available() / frameSize][frameSize]; int i = 0; for (; i < frames.length; i++) { byte[] frame = new byte[frameSize]; int numBytes = stream.read(frame, 0, frameSize); if (numBytes == -1) { break; } frames[i] = frame; } System.out.println("frameSize = " + frameSize); System.out.println("Number frames = " + frames.length); System.out.println("Number frames read = " + i); }}
然后:
frameBuffer frameStream = new frameBuffer(austream); //austream is the audiostream int frame = frameStream.numberframes() - 1; while (frame >= 0) { auline.write(frameStream.getframe(frame), 0, frameStream.frameSize()); frame--; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)