List of usage examples for javax.sound.midi MetaMessage getMessage
public byte[] getMessage()
From source file:de.ailis.midi4js.MessageReceiver.java
/** * Processes a meta message./*from ww w .j av a 2 s. c om*/ * * @param message * The message to process. * @param json * The JSON stringer. * @throws JSONException * When JSON output fails. */ private void processMetaMessage(final MetaMessage message, final JSONStringer json) throws JSONException { json.key("class").value("MetaMessage"); json.key("type").value(message.getType()); json.key("data"); json.array(); final byte[] data = message.getMessage(); final int max = Math.min(data.length, message.getLength()); for (int i = 0; i < max; i++) json.value(data[i] & 0xff); json.endArray(); }
From source file:net.abumarkub.midi.MIDISequencer.java
public void meta(MetaMessage meta) { if (1 == 2) {//just a way of ignoring the AppletContext send method StringBuilder jsMsg = new StringBuilder(); jsMsg.append(meta.getType());/*from w w w . j a v a 2 s. c om*/ jsMsg.append(","); jsMsg.append(meta.getStatus()); byte[] message = meta.getMessage(); for (int i = 0, maxi = message.length; i < maxi; i++) { jsMsg.append(","); jsMsg.append(message[i]); } sendMessageViaContext("javascript:midiBridge.sequencerMetaData(" + jsMsg.toString() + ")"); } else {//currently sending via Live Connect is preferred Object[] args = { meta }; _jsMetaEventListener.call("listener", args); } }