Example usage for javax.sound.midi SysexMessage getMessage

List of usage examples for javax.sound.midi SysexMessage getMessage

Introduction

In this page you can find the example usage for javax.sound.midi SysexMessage getMessage.

Prototype

public byte[] getMessage() 

Source Link

Document

Obtains the MIDI message data.

Usage

From source file:de.ailis.midi4js.MessageReceiver.java

/**
 * Processes a sysex message./* w w  w.j  a v a2 s . c o  m*/
 *
 * @param message
 *            The message to process.
 * @param json
 *            The JSON stringer.
 * @throws JSONException
 *             When JSON output fails.
 */
private void processSysexMessage(final SysexMessage message, final JSONStringer json) throws JSONException {
    json.key("class").value("SysexMessage");
    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();
}