publicstaticvoid main(String[] args) { boolean testPassed = true;
Clip clip = null; try {
clip = (Clip)AudioSystem.getLine(new DataLine.Info(Clip.class, audioFormat));
clip.open(audioFormat, dataBuffer, 0, dataBuffer.length);
} catch (LineUnavailableException ex) {
log(ex);
log("Cannot test (this is not failure)"); return;
} catch (IllegalArgumentException ex) {
log(ex);
log("Cannot test (this is not failure)"); return;
}
log("clip: " + clip.getClass().getName());
int len = clip.getFrameLength(); for (int pos=0; pos < len; pos += (len /100)) {
clip.setFramePosition(pos); int curPos = clip.getFramePosition(); if (Math.abs(pos - curPos) > MAX_FRAME_DELTA) {
log("Tried to set pos to " + pos + ", but got back " + curPos);
testPassed = false;
} else {
log("Sucessfully set pos to " + pos);
}
}
clip.close();
if (testPassed) {
log("Test PASSED.");
} else {
log("Test FAILED."); thrownew RuntimeException("Test FAILED (see log)");
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.