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
with the status value ShortMessage
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
.
MetaEventListener
Modifier and Type | Field and Description |
---|---|
static int |
META
Status byte for
MetaMessage (0xFF, or 255), which is used
in MIDI files. |
data, length
Modifier | Constructor and Description |
---|---|
|
MetaMessage()
Constructs a new
MetaMessage . |
protected |
MetaMessage(byte[] data)
Constructs a new
MetaMessage . |
|
MetaMessage(int type,
byte[] data,
int length)
Constructs a new
MetaMessage and sets the message parameters. |
Modifier and Type | Method and 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(int type,
byte[] data,
int length)
Sets the message parameters for a
MetaMessage . |
getLength, getMessage, getStatus, setMessage
public static final int META
MetaMessage
(0xFF, or 255), which is used
in MIDI files. It has the same value as SYSTEM_RESET, which
is used in the real-time "MIDI wire" protocol.MidiMessage.getStatus()
,
Constant Field Valuespublic MetaMessage()
MetaMessage
. The contents of
the message are not set here; use
setMessage
to set them subsequently.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.type
- meta-message type (must be less than 128)data
- the data bytes in the MIDI messagelength
- an amount of bytes in the data
byte array;
it should be non-negative and less than or equal to
data.length
InvalidMidiDataException
- if the parameter values do not specify
a valid MIDI meta messagesetMessage(int, byte[], int)
,
getType()
,
getData()
protected MetaMessage(byte[] data)
MetaMessage
.data
- an array of bytes containing the complete message.
The message data may be changed using the setMessage
method.setMessage(int, byte[], int)
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.
type
- meta-message type (must be less than 128)data
- the data bytes in the MIDI messagelength
- the number of bytes in the data
byte arrayInvalidMidiDataException
- if the
parameter values do not specify a valid MIDI meta messagepublic int getType()
MetaMessage
.MetaMessage
typepublic byte[] getData()
MidiMessage.getLength()
public Object clone()
clone
in class MidiMessage
Cloneable
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2019, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.