| 
 | Java™ Platform Standard Ed. 6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.sound.midi.MidiMessage
javax.sound.midi.ShortMessage
public class ShortMessage
A ShortMessage contains a MIDI message that has at most
 two data bytes following its status byte.  The types of MIDI message
 that satisfy this criterion are channel voice, channel mode, system common,
 and system real-time--in other words, everything except system exclusive
 and meta-events.  The ShortMessage class provides methods
 for getting and setting the contents of the MIDI message.
 
 A number of ShortMessage methods have integer parameters by which
 you specify a MIDI status or data byte.  If you know the numeric value, you
 can express it directly.  For system common and system real-time messages,
 you can often use the corresponding fields of ShortMessage, such as
 SYSTEM_RESET.  For channel messages,
 the upper four bits of the status byte are specified by a command value and
 the lower four bits are specified by a MIDI channel number. To
 convert incoming MIDI data bytes that are in the form of Java's signed bytes,
 you can use the conversion code
 given in the MidiMessage
SysexMessage, 
MetaMessage| Field Summary | |
|---|---|
| static int | ACTIVE_SENSINGStatus byte for Active Sensing message (0xFE, or 254). | 
| static int | CHANNEL_PRESSURECommand value for Channel Pressure (Aftertouch) message (0xD0, or 208) | 
| static int | CONTINUEStatus byte for Continue message (0xFB, or 251). | 
| static int | CONTROL_CHANGECommand value for Control Change message (0xB0, or 176) | 
| static int | END_OF_EXCLUSIVEStatus byte for End of System Exclusive message (0xF7, or 247). | 
| static int | MIDI_TIME_CODEStatus byte for MIDI Time Code Quarter Frame message (0xF1, or 241). | 
| static int | NOTE_OFFCommand value for Note Off message (0x80, or 128) | 
| static int | NOTE_ONCommand value for Note On message (0x90, or 144) | 
| static int | PITCH_BENDCommand value for Pitch Bend message (0xE0, or 224) | 
| static int | POLY_PRESSURECommand value for Polyphonic Key Pressure (Aftertouch) message (0xA0, or 160) | 
| static int | PROGRAM_CHANGECommand value for Program Change message (0xC0, or 192) | 
| static int | SONG_POSITION_POINTERStatus byte for Song Position Pointer message (0xF2, or 242). | 
| static int | SONG_SELECTStatus byte for MIDI Song Select message (0xF3, or 243). | 
| static int | STARTStatus byte for Start message (0xFA, or 250). | 
| static int | STOPStatus byte for Stop message (0xFC, or 252). | 
| static int | SYSTEM_RESETStatus byte for System Reset message (0xFF, or 255). | 
| static int | TIMING_CLOCKStatus byte for Timing Clock messagem (0xF8, or 248). | 
| static int | TUNE_REQUESTStatus byte for Tune Request message (0xF6, or 246). | 
| Fields inherited from class javax.sound.midi.MidiMessage | 
|---|
| data, length | 
| Constructor Summary | |
|---|---|
|   | ShortMessage()Constructs a new ShortMessage. | 
| protected  | ShortMessage(byte[] data)Constructs a new ShortMessage. | 
| Method Summary | |
|---|---|
|  Object | clone()Creates a new object of the same class and with the same contents as this object. | 
|  int | getChannel()Obtains the MIDI channel associated with this event. | 
|  int | getCommand()Obtains the MIDI command associated with this event. | 
|  int | getData1()Obtains the first data byte in the message. | 
|  int | getData2()Obtains the second data byte in the message. | 
| protected  int | getDataLength(int status)Retrieves the number of data bytes associated with a particular status byte value. | 
|  void | setMessage(int status)Sets the parameters for a MIDI message that takes no data bytes. | 
|  void | setMessage(int status,
           int data1,
           int data2)Sets the parameters for a MIDI message that takes one or two data bytes. | 
|  void | setMessage(int command,
           int channel,
           int data1,
           int data2)Sets the short message parameters for a channel message which takes up to two data bytes. | 
| Methods inherited from class javax.sound.midi.MidiMessage | 
|---|
| getLength, getMessage, getStatus, setMessage | 
| Methods inherited from class java.lang.Object | 
|---|
| equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final int MIDI_TIME_CODE
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int SONG_POSITION_POINTER
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int SONG_SELECT
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int TUNE_REQUEST
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int END_OF_EXCLUSIVE
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int TIMING_CLOCK
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int START
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int CONTINUE
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int STOP
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int ACTIVE_SENSING
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int SYSTEM_RESET
MidiMessage.getStatus(), 
Constant Field Valuespublic static final int NOTE_OFF
public static final int NOTE_ON
public static final int POLY_PRESSURE
public static final int CONTROL_CHANGE
public static final int PROGRAM_CHANGE
public static final int CHANNEL_PRESSURE
public static final int PITCH_BEND
| Constructor Detail | 
|---|
public ShortMessage()
ShortMessage.  The
 contents of the new message are guaranteed to specify
 a valid MIDI message.  Subsequently, you may set the
 contents of the message using one of the setMessage
 methods.
setMessage(int)protected ShortMessage(byte[] data)
ShortMessage.
data - an array of bytes containing the complete message.
 The message data may be changed using the setMessage
 method.setMessage(int)| Method Detail | 
|---|
public void setMessage(int status)
                throws InvalidMidiDataException
status - the MIDI status byte
InvalidMidiDataExceptionstatus does not
 specify a valid MIDI status byte for a message that requires no data bytes.
InvalidMidiDataExceptionsetMessage(int, int, int), 
setMessage(int, int, int, int)
public void setMessage(int status,
                       int data1,
                       int data2)
                throws InvalidMidiDataException
status - the MIDI status bytedata1 - the first data bytedata2 - the second data byte
InvalidMidiDataExceptionInvalidMidiDataExceptionsetMessage(int, int, int, int), 
setMessage(int)
public void setMessage(int command,
                       int channel,
                       int data1,
                       int data2)
                throws InvalidMidiDataException
command - the MIDI command represented by this messagechannel - the channel associated with the messagedata1 - the first data bytedata2 - the second data byte
InvalidMidiDataExceptionInvalidMidiDataExceptionsetMessage(int, int, int), 
setMessage(int), 
getCommand(), 
getChannel(), 
getData1(), 
getData2()public int getChannel()
setMessage(int, int, int, int)public int getCommand()
setMessage(int, int, int, int)public int getData1()
data1 fieldsetMessage(int, int, int)public int getData2()
data2 fieldsetMessage(int, int, int)public Object clone()
clone in class MidiMessageCloneable
protected final int getDataLength(int status)
                           throws InvalidMidiDataException
status - status byte value, which must represent a short MIDI message
InvalidMidiDataExceptionstatus argument does not represent the status byte for any
 short message
InvalidMidiDataException| 
 | Java™ Platform Standard Ed. 6 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.