- java.lang.Object
-
- javax.sound.midi.MidiMessage
-
- javax.sound.midi.MetaMessage
-
- All Implemented Interfaces:
- Cloneable
public class MetaMessage extends MidiMessage
AMetaMessage
is a
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 theMidiMessage
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 valueShortMessage
0xFF
represents a system reset message. In MIDI files, this same status value denotes aMetaMessage
. The types of meta-message are distinguished from each other by the first byte that follows the status byte0xFF
. The subsequent bytes are data bytes. As with system exclusive messages, there are an arbitrary number of data bytes, depending on the type ofMetaMessage
.- See Also:
MetaEventListener
-
-
Field Summary
Fields Modifier and Type Field and Description static int
META
Status byte forMetaMessage
(0xFF, or 255), which is used in MIDI files.
-
Constructor Summary
Constructors Modifier Constructor and Description MetaMessage()
Constructs a newMetaMessage
.protected
MetaMessage(byte[] data)
Constructs a newMetaMessage
.MetaMessage(int type, byte[] data, int length)
Constructs a newMetaMessage
and sets the message parameters.
-
Method Summary
Methods 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 theMetaMessage
.void
setMessage(int type, byte[] data, int length)
Sets the message parameters for aMetaMessage
.-
Methods inherited from class javax.sound.midi.MidiMessage
getLength, getMessage, getStatus, setMessage
-
-
-
-
Field Detail
-
META
public static final int META
Status byte forMetaMessage
(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.- See Also:
MidiMessage.getStatus()
, Constant Field Values
-
-
Constructor Detail
-
MetaMessage
public MetaMessage()
Constructs a newMetaMessage
. The contents of the message are not set here; usesetMessage
to set them subsequently.
-
MetaMessage
public MetaMessage(int type, byte[] data, int length) throws InvalidMidiDataException
Constructs a newMetaMessage
and sets the message parameters. The contents of the message can be changed by using thesetMessage
method.- Parameters:
type
- meta-message type (must be less than 128)data
- the data bytes in the MIDI messagelength
- an amount of bytes in thedata
byte 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:
setMessage(int, byte[], int)
,getType()
,getData()
-
MetaMessage
protected MetaMessage(byte[] data)
Constructs a newMetaMessage
.- Parameters:
data
- an array of bytes containing the complete message. The message data may be changed using thesetMessage
method.- See Also:
setMessage(int, byte[], int)
-
-
Method Detail
-
setMessage
public void setMessage(int type, byte[] data, int length) throws InvalidMidiDataException
Sets the message parameters for aMetaMessage
. Since only one status byte value,0xFF
, is allowed for meta-messages, it does not need to be specified here. Calls to
returngetStatus
0xFF
for all meta-messages.The
type
argument should be a valid value for the byte that follows the status byte in theMetaMessage
. Thedata
argument should contain all the subsequent bytes of theMetaMessage
. In other words, the byte that specifies the type ofMetaMessage
is not considered a data byte.- Parameters:
type
- meta-message type (must be less than 128)data
- the data bytes in the MIDI messagelength
- the number of bytes in thedata
byte array- Throws:
- if the parameter values do not specify a valid MIDI meta messageInvalidMidiDataException
InvalidMidiDataException
-
getType
public int getType()
Obtains the type of theMetaMessage
.- Returns:
- an integer representing the
MetaMessage
type
-
getData
public byte[] getData()
Obtains a copy of the data for the meta message. The returned array of bytes does not include the status byte or the message length data. The length of the data for the meta message is the length of the array. Note that the length of the entire message includes the status byte and the meta message type byte, and therefore may be longer than the returned array.- Returns:
- array containing the meta message data.
- See Also:
MidiMessage.getLength()
-
clone
public Object clone()
Creates a new object of the same class and with the same contents as this object.- Specified by:
clone
in classMidiMessage
- Returns:
- a clone of this instance
- See Also:
Cloneable
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
22/12/2024 10:25:01 Cette version de la page est en cache (à la date du 22/12/2024 10:25:01) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 30/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/sound/midi/MetaMessage.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.