向后播放WAV文件

向后播放WAV文件,第1张

向后播放WAV文件

!!!!!!

我自己解决了这个问题(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--; }


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5130319.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-17
下一篇 2022-11-17

发表评论

登录后才能评论

评论列表(0条)

保存