Example usage for javax.sound.midi SysexMessage SysexMessage

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

Introduction

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

Prototype

public SysexMessage() 

Source Link

Document

Constructs a new SysexMessage .

Usage

From source file:com.rockhoppertech.music.midi.js.MIDIEvent.java

/**
 * Create a JavaSound MidiMessage from this instance.
 * /*  w ww  .ja  v  a 2  s  .  c o m*/
 * @param mm
 * @return
 */
private MidiMessage createMidiMessage() {
    MidiMessage mm = null;
    if (MIDIUtils.isChannelMessage(status)) {
        logger.debug("isChannelMessage for " + Integer.toHexString(status));
        mm = MIDIUtils.createShortMessage(status, bytes);

    } else if (MIDIUtils.isMetaMessage(status)) {
        logger.debug("MetaMessage: " + Integer.toHexString(status));
        MetaMessage meta = new MetaMessage();
        try {
            meta.setMessage(metaMessageType, bytes, bytes.length);
        } catch (InvalidMidiDataException e) {
            e.printStackTrace();
        }
        mm = meta;

    } else if (MIDIUtils.isSysexMessage(status)) {
        logger.debug("Sysex message: " + Integer.toHexString(status));
        SysexMessage sex = new SysexMessage();
        try {
            sex.setMessage(bytes, bytes.length);
        } catch (InvalidMidiDataException e) {
            e.printStackTrace();
        }
        mm = sex;
    } else {
        logger.debug("Unknown status " + Integer.toHexString(status));
    }
    return mm;
}