use of org.openksavi.sponge.midi.event.MidiSysexMessageEvent in project sponge by softelnet.
the class MidiSpongeEventReceiver method send.
@Override
public void send(MidiMessage message, long timeStamp) {
try {
if (sound) {
midiPlugin.sound(message);
}
MidiMessageEvent<?> event;
if (message instanceof ShortMessage) {
event = MidiUtils.createShortMessageEvent(midiPlugin, (ShortMessage) message, timeStamp);
} else if (message instanceof SysexMessage) {
event = new MidiSysexMessageEvent(midiPlugin.getMidiSysexMessageEventName(), midiPlugin.getEngine().getDefaultParameters().getEventClonePolicy(), (SysexMessage) message, timeStamp);
} else if (message instanceof MetaMessage) {
event = new MidiMetaMessageEvent(midiPlugin.getMidiMetaMessageEventName(), midiPlugin.getEngine().getDefaultParameters().getEventClonePolicy(), (MetaMessage) message, timeStamp);
} else {
throw new SpongeException("Unknown MIDI message type: " + message.getClass());
}
midiPlugin.getEngine().getOperations().event(event).send();
} catch (Exception e) {
logger.error("send", e);
}
}
Aggregations