Java examples for javax.sound.midi:MidiMessage
Determines if the given ShortMessage is a MIDI NOTE OFF message.
//package com.java2s; import javax.sound.midi.ShortMessage; public class Main { /**/*from w ww. j a va2s . co m*/ * Determines if the given ShortMessage is a MIDI NOTE OFF message. Note * that the MIDI specification says that a NOTE ON with velocity=0 is * equivalent to a NOTE OFF. * @param sm - the ShortMessage to check * @return <tt>true</tt> if the ShortMessage is a MIDI NOTE OFF message */ public static boolean isNoteOff(ShortMessage sm) { final int command = sm.getCommand(); return command == ShortMessage.NOTE_OFF || (command == ShortMessage.NOTE_ON && sm.getData2() == 0); } }