ShortMessage sm = (ShortMessage) message; System.out.print("Channel: " + sm.getChannel() + " "); if (sm.getCommand() == NOTE_ON) { int key = sm.getData1(); int octave = (key / 12)-1; int velocity = sm.getData2(); System.out.println("Note on, " + noteName + octave + " key=" + key + " velocity: " + velocity); } else if (sm.getCommand() == NOTE_OFF) { int key = sm.getData1(); int octave = (key / 12)-1; System.out.println("Note off, " + noteName + octave + " key=" + key + " velocity: " + velocity); } else { System.out.println("Command:" + sm.getCommand());
/** * Returns the MIDI short message command. * * @return the MIDI short message command. */ public int getCommand() { return getMessage().getCommand(); }
protected void notifyListeners(MidiMessage message) { if (message instanceof MetaMessage) { // IDEA: use extra thread for event delivery sendMetaMessage((MetaMessage) message); } else if (message instanceof ShortMessage && ((ShortMessage) message).getCommand() == ShortMessage.CONTROL_CHANGE) { sendControllerEvent((ShortMessage) message); } }
protected void notifyListeners(MidiMessage message) { if (message instanceof MetaMessage) { // IDEA: use extra thread for event delivery sendMetaMessage((MetaMessage) message); } else if (message instanceof ShortMessage && ((ShortMessage) message).getCommand() == ShortMessage.CONTROL_CHANGE) { sendControllerEvent((ShortMessage) message); } }
int command = shortMessage.getCommand(); int status = shortMessage.getStatus();
if (message instanceof ShortMessage) { ShortMessage shortMessage = (ShortMessage) message; if(shortMessage.getCommand() == ShortMessage.NOTE_ON) { int channel = shortMessage.getChannel(); int pitch = shortMessage.getData1(); int vel = shortMessage.getData2(); if(vel > 0) { shortMessage.setMessage(ShortMessage.NOTE_ON, channel, pitch + pitchUpOrDown, vel); } } }
int command = shortMessage.getCommand(); int status = shortMessage.getStatus();
/***** midi receiver implementation **************************************************************/ public void send(MidiMessage message, long timeStamp) { if (message instanceof ShortMessage) { ShortMessage shortMessage = (ShortMessage) message; int command = shortMessage.getCommand(); int status = shortMessage.getStatus(); if (command != MIDI_REALTIME_COMMAND) { switch (command) { case NOTE_ON: // System.out.printf("Keyboard NOTE ON: %d, %d, %d\n", shortMessage.getChannel(), shortMessage.getData1(), shortMessage.getData2()); outputReceiver.send(message, timeStamp); break; case NOTE_OFF: // System.out.printf("Keyboard NOTE OFF: %d, %d, %d\n", shortMessage.getChannel(), shortMessage.getData1(), shortMessage.getData2()); outputReceiver.send(message, timeStamp); break; case CONTROL_CHANGE: // System.out.printf("Keyboard MIDI CC: %d, %d, %d\n", shortMessage.getChannel(), shortMessage.getData1(), shortMessage.getData2()); outputReceiver.send(message, timeStamp); break; default: } } } }
System.out.println("Command " + sm.getCommand()); System.out.println("data1 " + sm.getData1()); System.out.println("data2 " + sm.getData2());
if (mm instanceof ShortMessage) { ShortMessage sm = (ShortMessage) mm; int command = sm.getCommand(); int com = -1; if (command == ShortMessage.NOTE_ON) { int command = event.getCommand(); if (command == ShortMessage.NOTE_ON) { System.out.println("CEL - note on!");
int command = shortMessage.getCommand();
int command = shortMessage.getCommand(); int status = shortMessage.getStatus();
return res; switch (sm.getCommand()) { case 0xC0: case 0xD0:
int command = shortMessage.getCommand(); int status = shortMessage.getStatus();
if (shortMessage.getCommand() != SliderboardTools.STATUS)
int command = shortMessage.getCommand(); int status = shortMessage.getStatus();
int command = shortMessage.getCommand(); int status = shortMessage.getStatus();
int nCommand = shortMsg.getCommand(); int nData1 = shortMsg.getData1(); int nData2 = shortMsg.getData2();
int nCommand = shortMsg.getCommand(); int nData1 = shortMsg.getData1(); int nData2 = shortMsg.getData2();
public String decodeMessage(ShortMessage message) switch (message.getCommand()) break; if (message.getCommand() != 0xF0)