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 class description.
SysexMessage, MetaMessage
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ACTIVE_SENSING
Status byte for Active Sensing message (0xFE, or 254). |
| public static final int | CHANNEL_PRESSURE
Command value for Channel Pressure (Aftertouch) message (0xD0, or 208). |
| public static final int | CONTINUE
Status byte for Continue message (0xFB, or 251). |
| public static final int | CONTROL_CHANGE
Command value for Control Change message (0xB0, or 176). |
| public static final int | END_OF_EXCLUSIVE
Status byte for End of System Exclusive message (0xF7, or 247). |
| public static final int | MIDI_TIME_CODE
Status byte for MIDI Time Code Quarter Frame message (0xF1, or 241). |
| public static final int | NOTE_OFF
Command value for Note Off message (0x80, or 128). |
| public static final int | NOTE_ON
Command value for Note On message (0x90, or 144). |
| public static final int | PITCH_BEND
Command value for Pitch Bend message (0xE0, or 224). |
| public static final int | POLY_PRESSURE
Command value for Polyphonic Key Pressure (Aftertouch) message (0xA0, or 160). |
| public static final int | PROGRAM_CHANGE
Command value for Program Change message (0xC0, or 192). |
| public static final int | SONG_POSITION_POINTER
Status byte for Song Position Pointer message (0xF2, or 242). |
| public static final int | SONG_SELECT
Status byte for MIDI Song Select message (0xF3, or 243). |
| public static final int | START
Status byte for Start message (0xFA, or 250). |
| public static final int | STOP
Status byte for Stop message (0xFC, or 252). |
| public static final int | SYSTEM_RESET
Status byte for System Reset message (0xFF, or 255). |
| public static final int | TIMING_CLOCK
Status byte for Timing Clock message (0xF8, or 248). |
| public static final int | TUNE_REQUEST
Status byte for Tune Request message (0xF6, or 246). |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ShortMessage(int
the MIDI status byte status)Constructs a new |
| public | ShortMessage(int
the MIDI status byte status, int the first data byte data1, int the second data byte data2)Constructs a new |
| public | ShortMessage(int
the MIDI command represented by this message command, int the channel associated with the message channel, int the first data byte data1, int the second data byte data2)Constructs a new |
| protected | ShortMessage(byte[]
an array of bytes containing the complete message. The
message data may be changed using the data)setMessage method.Constructs a new |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: a clone of this instanceImplements abstract javax. Creates a new object of the same class and with the same contents as this object. |
| public int | Returns: MIDI channel associated with the messageObtains the MIDI channel associated with this event. |
| public int | Returns: the MIDI command associated with this eventObtains the MIDI command associated with this event. |
| public int | |
| public int | |
| protected final int | Returns: data length in bytes (0, 1, or 2)status byte value, which must represent a short MIDI
message status)Retrieves the number of data bytes associated with a particular status byte value. |
| public void | setMessage(int
the MIDI status byte status)Sets the parameters for a MIDI message that takes no data bytes. |
| public void | setMessage(int
the MIDI status byte status, int the first data byte data1, int the second data byte data2)Sets the parameters for a MIDI message that takes one or two data bytes. |
| public void | setMessage(int
the MIDI command represented by this message command, int the channel associated with the message channel, int the first data byte data1, int the second data byte data2)Sets the short message parameters for a channel message which takes up to two data bytes. |
| ACTIVE_SENSING | back to summary |
|---|---|
| public static final int ACTIVE_SENSING Status byte for Active Sensing message (0xFE, or 254).
| |
| CHANNEL_PRESSURE | back to summary |
|---|---|
| public static final int CHANNEL_PRESSURE Command value for Channel Pressure (Aftertouch) message (0xD0, or 208). | |
| CONTINUE | back to summary |
|---|---|
| public static final int CONTINUE Status byte for Continue message (0xFB, or 251).
| |
| CONTROL_CHANGE | back to summary |
|---|---|
| public static final int CONTROL_CHANGE Command value for Control Change message (0xB0, or 176). | |
| END_OF_EXCLUSIVE | back to summary |
|---|---|
| public static final int END_OF_EXCLUSIVE Status byte for End of System Exclusive message (0xF7, or 247).
| |
| MIDI_TIME_CODE | back to summary |
|---|---|
| public static final int MIDI_TIME_CODE Status byte for MIDI Time Code Quarter Frame message (0xF1, or 241).
| |
| NOTE_OFF | back to summary |
|---|---|
| public static final int NOTE_OFF Command value for Note Off message (0x80, or 128). | |
| NOTE_ON | back to summary |
|---|---|
| public static final int NOTE_ON Command value for Note On message (0x90, or 144). | |
| PITCH_BEND | back to summary |
|---|---|
| public static final int PITCH_BEND Command value for Pitch Bend message (0xE0, or 224). | |
| POLY_PRESSURE | back to summary |
|---|---|
| public static final int POLY_PRESSURE Command value for Polyphonic Key Pressure (Aftertouch) message (0xA0, or 160). | |
| PROGRAM_CHANGE | back to summary |
|---|---|
| public static final int PROGRAM_CHANGE Command value for Program Change message (0xC0, or 192). | |
| SONG_POSITION_POINTER | back to summary |
|---|---|
| public static final int SONG_POSITION_POINTER Status byte for Song Position Pointer message (0xF2, or 242).
| |
| SONG_SELECT | back to summary |
|---|---|
| public static final int SONG_SELECT Status byte for MIDI Song Select message (0xF3, or 243).
| |
| START | back to summary |
|---|---|
| public static final int START Status byte for Start message (0xFA, or 250).
| |
| STOP | back to summary |
|---|---|
| public static final int STOP Status byte for Stop message (0xFC, or 252).
| |
| SYSTEM_RESET | back to summary |
|---|---|
| public static final int SYSTEM_RESET Status byte for System Reset message (0xFF, or 255).
| |
| TIMING_CLOCK | back to summary |
|---|---|
| public static final int TIMING_CLOCK Status byte for Timing Clock message (0xF8, or 248).
| |
| TUNE_REQUEST | back to summary |
|---|---|
| public static final int TUNE_REQUEST Status byte for Tune Request message (0xF6, or 246).
| |
| ShortMessage | back to summary |
|---|---|
| public ShortMessage() Constructs a new
| |
| ShortMessage | back to summary |
|---|---|
| public ShortMessage(int status) throws InvalidMidiDataException Constructs a new
| |
| ShortMessage | back to summary |
|---|---|
| public ShortMessage(int status, int data1, int data2) throws InvalidMidiDataException Constructs a new
| |
| ShortMessage | back to summary |
|---|---|
| public ShortMessage(int command, int channel, int data1, int data2) throws InvalidMidiDataException Constructs a new
| |
| ShortMessage | back to summary |
|---|---|
| protected ShortMessage(byte[] data) Constructs a new
| |
| clone | back to summary |
|---|---|
| public Object clone() Implements abstract javax. Creates a new object of the same class and with the same contents as this object. | |
| getChannel | back to summary |
|---|---|
| public int getChannel() Obtains the MIDI channel associated with this event. This method assumes that the event is a MIDI channel message; if not, the return value will not be meaningful.
| |
| getCommand | back to summary |
|---|---|
| public int getCommand() Obtains the MIDI command associated with this event. This method assumes that the event is a MIDI channel message; if not, the return value will not be meaningful.
| |
| getData1 | back to summary |
|---|---|
| public int getData1() Obtains the first data byte in the message.
| |
| getData2 | back to summary |
|---|---|
| public int getData2() Obtains the second data byte in the message.
| |
| getDataLength | back to summary |
|---|---|
| protected final int getDataLength(int status) throws InvalidMidiDataException Retrieves the number of data bytes associated with a particular status byte value.
| |
| setMessage | back to summary |
|---|---|
| public void setMessage(int status) throws InvalidMidiDataException Sets the parameters for a MIDI message that takes no data bytes.
| |
| setMessage | back to summary |
|---|---|
| public void setMessage(int status, int data1, int data2) throws InvalidMidiDataException Sets the parameters for a MIDI message that takes one or two data bytes. If the message takes only one data byte, the second data byte is ignored; if the message does not take any data bytes, both data bytes are ignored.
| |
| setMessage | back to summary |
|---|---|
| public void setMessage(int command, int channel, int data1, int data2) throws InvalidMidiDataException Sets the short message parameters for a channel message which takes up to two data bytes. If the message only takes one data byte, the second data byte is ignored; if the message does not take any data bytes, both data bytes are ignored.
| |