這裏是我的代碼示例:
while ((((bytesRead = this.audioInputStream.read(audioDataFull, 0, audioDataFull.length)) != -1) && (!this.leaveThread))) {
line.write(audioDataFull, 0, bytesRead);
this.nb++;
while (this.audioWav.isPause()) {
if (test) {
try {
this.audioInputStream.skip((long) -(this.audioInputStream.getFormat().getSampleRate()
* (this.audioInputStream.getFormat().getSampleSizeInBits()/8) * TraitementXML.tmpXml.getBufferRelecture()));
test = false;
} catch (final Exception e) {
this.audioInputStream.skip(-(this.nb * bytesRead));
this.nb = 0;
test = false;
}
}
try {
Thread.sleep(1000);
} catch (final InterruptedException e) {
logger.error(e.getMessage(), e);
}
}
}
你可以發佈一些代碼? – gpasch
您可能會發現[this](http://stackoverflow.com/questions/1267488/play-wav-file-backward)答案有幫助。 – Lemmmy
謝謝你的回答。但是,在開始進行上述處理之前,給定頁面的代碼會完全加載音頻文件。對於小型音頻文件,不會造成問題,但對於較大的文件,處理時間會過長。 – Lorenzo