/* * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
if (isTestExecuted) { if (isTestPassed && sysExTestPassed) {
out("Test PASSED.");
} else { if (isTestPassed
&& !sysExTestPassed
&& (System.getProperty("os.name").startsWith("Windows"))) {
out("Some Windows MIDI i/o drivers have a problem with larger ");
out("sys ex messages. The failing sys ex cases are OK, therefore.");
out("Test PASSED.");
} else { thrownew Exception("Test FAILED.");
}
}
} else {
out("Test NOT FAILED");
}
}
privatestaticboolean testMessage(MidiMessage message) {
receivedMessage = null;
baos = new ByteArrayOutputStream();
expectedBytes = message.getLength();
receivedBytes = 0;
System.out.print("Sending message " + getMessageString(message.getMessage())+"...");
receiver.send(message, -1); /* sending 3 bytes can roughly be done in 1 millisecond, * so this estimate waits at max 3 times longer than the message takes, * plus a little offset to allow the MIDI subsystem some processing time
*/ int offset = 300; // standard offset 100 millis if (message instanceof SysexMessage) { // add a little processing time to sysex messages
offset += 1000;
} if (receivedBytes < expectedBytes) {
sleep(expectedBytes + offset);
} boolean equal; byte[] data = baos.toByteArray(); if (data.length > 0) {
equal = messagesEqual(message.getMessage(), data);
} else {
equal = messagesEqual(message, receivedMessage); if (receivedMessage != null) {
data = receivedMessage.getMessage();
} else {
data = null;
}
} if (!equal) { if ((message.getStatus() & 0xF0) == ShortMessage.PITCH_BEND) {
out("NOT failed (may expose a bug in ALSA)");
equal = true;
sleep(100);
} if ((message.getStatus() == 0xF6) && (message.getLength() == 1)) {
out("NOT failed (may expose an issue on Solaris)");
equal = true;
sleep(100);
} elseif ((message.getStatus()) == 0xF0 && message.getLength() < 4) {
out("NOT failed (not a correct sys ex message)");
equal = true;
sleep(200);
} else {
out("FAILED:");
out(" received as " + getMessageString(data));
}
} else {
System.out.println("OK");
} return equal;
}
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.