Java examples for javax.sound.midi:MidiMessage
Determines if the given ShortMessage is a MIDI NOTE ON message.
//package com.java2s; import javax.sound.midi.ShortMessage; public class Main { /**//from w w w.j a va 2 s. c o m * Determines if the given ShortMessage is a MIDI NOTE ON 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 ON message */ public static boolean isNoteOn(ShortMessage sm) { return sm.getCommand() == ShortMessage.NOTE_ON && sm.getData2() > 0; } }