Class MetaMessage
- All Implemented Interfaces:
Cloneable
public class MetaMessage extends MidiMessage
MetaMessage is a MidiMessage that is not meaningful to synthesizers, but that can be stored in a MIDI file and interpreted by a sequencer program. (See the discussion in the MidiMessage class description.) The Standard MIDI Files specification defines various types of meta-events, such as sequence number, lyric, cue point, and set tempo. There are also meta-events for such information as lyrics, copyrights, tempo indications, time and key signatures, markers, etc. For more information, see the Standard MIDI Files 1.0 specification, which is part of the Complete MIDI 1.0 Detailed Specification published by the MIDI Manufacturer's Association (http://www.midi.org). When data is being transported using MIDI wire protocol, a ShortMessage with the status value 0xFF represents a system reset message. In MIDI files, this same status value denotes a MetaMessage. The types of meta-message are distinguished from each other by the first byte that follows the status byte 0xFF. The subsequent bytes are data bytes. As with system exclusive messages, there are an arbitrary number of data bytes, depending on the type of MetaMessage.
- See Also:
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
static final int |
META |
Status byte for MetaMessage (0xFF, or 255), which is used in MIDI files. |
Fields declared in class MidiMessage
data, length | Modifier and Type | Field | Description |
|---|---|---|
protected byte[] |
data |
The MIDI message data. |
protected int |
length |
The number of bytes in the MIDI message, including the status byte and any data bytes. |
Constructor Summary
| Modifier | Constructor | Description |
|---|---|---|
| Constructs a new MetaMessage. |
||
protected |
Constructs a new MetaMessage. |
|
| Constructs a new MetaMessage and sets the message parameters. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
Object |
clone() |
Creates a new object of the same class and with the same contents as this object. |
byte[] |
getData() |
Obtains a copy of the data for the meta message. |
int |
getType() |
Obtains the type of the MetaMessage. |
void |
setMessage |
Sets the message parameters for a MetaMessage. |
Methods declared in class MidiMessage
getLength, getMessage, getStatus, setMessage | Modifier and Type | Method | Description |
|---|---|---|
int |
getLength() |
Obtains the total length of the MIDI message in bytes. |
byte[] |
getMessage() |
Obtains the MIDI message data. |
int |
getStatus() |
Obtains the status byte for the MIDI message. |
protected void |
setMessage |
Sets the data for the MIDI message. |
Methods declared in class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
String |
toString() |
Returns a string representation of the object. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Field Details
META
public static final int META
MetaMessage (0xFF, or 255), which is used in MIDI files. It has the same value as ShortMessage.SYSTEM_RESET, which is used in the real-time "MIDI wire" protocol.- See Also:
Constructor Details
MetaMessage
public MetaMessage()
MetaMessage. The contents of the message are not set here; use setMessage to set them subsequently.MetaMessage
public MetaMessage(int type, byte[] data, int length) throws InvalidMidiDataException
MetaMessage and sets the message parameters. The contents of the message can be changed by using the setMessage method.- Parameters:
-
type- meta-message type (must be less than 128) -
data- the data bytes in the MIDI message -
length- an amount of bytes in thedatabyte array; it should be non-negative and less than or equal todata.length - Throws:
-
InvalidMidiDataException- if the parameter values do not specify a valid MIDI meta message - Since:
- 1.7
- See Also:
MetaMessage
protected MetaMessage(byte[] data)
MetaMessage.- Parameters:
-
data- an array of bytes containing the complete message. The message data may be changed using thesetMessagemethod. - See Also:
Method Details
setMessage
public void setMessage(int type, byte[] data, int length) throws InvalidMidiDataException
MetaMessage. Since only one status byte value, 0xFF, is allowed for meta-messages, it does not need to be specified here. Calls to getStatus return 0xFF for all meta-messages. The type argument should be a valid value for the byte that follows the status byte in the MetaMessage. The data argument should contain all the subsequent bytes of the MetaMessage. In other words, the byte that specifies the type of MetaMessage is not considered a data byte.
- Parameters:
-
type- meta-message type (must be less than 128) -
data- the data bytes in the MIDI message -
length- the number of bytes in thedatabyte array - Throws:
-
InvalidMidiDataException- if the parameter values do not specify a valid MIDI meta message
getType
public int getType()
MetaMessage.- Returns:
- an integer representing the
MetaMessagetype
getData
public byte[] getData()
- Returns:
- array containing the meta message data
- See Also:
clone
public Object clone()
- Specified by:
-
clonein classMidiMessage - Returns:
- a clone of this instance
- See Also:
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.