javax.sound.midi
Class MetaMessage

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.sound.midi.MidiMessage sample code for javax.sound.midi.MidiMessage definition code for javax.sound.midi.MidiMessage 
      extended by javax.sound.midi.MetaMessage
All Implemented Interfaces:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

public class MetaMessage
extends MidiMessage sample code for javax.sound.midi.MidiMessage definition code for javax.sound.midi.MidiMessage

A MetaMessage is a MidiMessage sample code for javax.sound.midi.MidiMessage definition code for javax.sound.midi.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 sample code for javax.sound.midi.ShortMessage definition code for javax.sound.midi.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:
MetaEventListener sample code for javax.sound.midi.MetaEventListener definition code for javax.sound.midi.MetaEventListener

Field Summary
static int META sample code for javax.sound.midi.MetaMessage.META definition code for javax.sound.midi.MetaMessage.META
          Status byte for MetaMessage (0xFF, or 255), which is used in MIDI files.
 
Fields inherited from class javax.sound.midi.MidiMessage sample code for javax.sound.midi.MidiMessage definition code for javax.sound.midi.MidiMessage
data sample code for javax.sound.midi.MidiMessage.data definition code for javax.sound.midi.MidiMessage.data , length sample code for javax.sound.midi.MidiMessage.length definition code for javax.sound.midi.MidiMessage.length
 
Constructor Summary
  MetaMessage sample code for javax.sound.midi.MetaMessage.MetaMessage() definition code for javax.sound.midi.MetaMessage.MetaMessage() ()
          Constructs a new MetaMessage.
protected MetaMessage sample code for javax.sound.midi.MetaMessage.MetaMessage(byte[]) definition code for javax.sound.midi.MetaMessage.MetaMessage(byte[]) (byte[] data)
          Constructs a new MetaMessage.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for javax.sound.midi.MetaMessage.clone() definition code for javax.sound.midi.MetaMessage.clone() ()
          Creates a new object of the same class and with the same contents as this object.
 byte[] getData sample code for javax.sound.midi.MetaMessage.getData() definition code for javax.sound.midi.MetaMessage.getData() ()
          Obtains a copy of the data for the meta message.
 int getType sample code for javax.sound.midi.MetaMessage.getType() definition code for javax.sound.midi.MetaMessage.getType() ()
          Obtains the type of the MetaMessage.
 void setMessage sample code for javax.sound.midi.MetaMessage.setMessage(int, byte[], int) definition code for javax.sound.midi.MetaMessage.setMessage(int, byte[], int) (int type, byte[] data, int length)
          Sets the message parameters for a MetaMessage.
 
Methods inherited from class javax.sound.midi.MidiMessage sample code for javax.sound.midi.MidiMessage definition code for javax.sound.midi.MidiMessage
getLength sample code for javax.sound.midi.MidiMessage.getLength() definition code for javax.sound.midi.MidiMessage.getLength() , getMessage sample code for javax.sound.midi.MidiMessage.getMessage() definition code for javax.sound.midi.MidiMessage.getMessage() , getStatus sample code for javax.sound.midi.MidiMessage.getStatus() definition code for javax.sound.midi.MidiMessage.getStatus() , setMessage sample code for javax.sound.midi.MidiMessage.setMessage(byte[], int) definition code for javax.sound.midi.MidiMessage.setMessage(byte[], int)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

META sample code for javax.sound.midi.MetaMessage.META

public static final int META
Status byte for 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.

See Also:
MidiMessage.getStatus() sample code for javax.sound.midi.MidiMessage.getStatus() definition code for javax.sound.midi.MidiMessage.getStatus() , Constant Field Values
Constructor Detail

MetaMessage sample code for javax.sound.midi.MetaMessage() definition code for javax.sound.midi.MetaMessage()

public MetaMessage()
Constructs a new MetaMessage. The contents of the message are not set here; use setMessage sample code for javax.sound.midi.MetaMessage.setMessage(int, byte[], int) definition code for javax.sound.midi.MetaMessage.setMessage(int, byte[], int) to set them subsequently.


MetaMessage sample code for javax.sound.midi.MetaMessage(byte[]) definition code for javax.sound.midi.MetaMessage(byte[])

protected MetaMessage(byte[] data)
Constructs a new MetaMessage.

Parameters:
data - an array of bytes containing the complete message. The message data may be changed using the setMessage method.
See Also:
setMessage(int, byte[], int) sample code for javax.sound.midi.MetaMessage.setMessage(int, byte[], int) definition code for javax.sound.midi.MetaMessage.setMessage(int, byte[], int)
Method Detail

setMessage sample code for javax.sound.midi.MetaMessage.setMessage(int, byte[], int) definition code for javax.sound.midi.MetaMessage.setMessage(int, byte[], int)

public void setMessage(int type,
                       byte[] data,
                       int length)
                throws InvalidMidiDataException sample code for javax.sound.midi.InvalidMidiDataException definition code for javax.sound.midi.InvalidMidiDataException 
Sets the message parameters for a MetaMessage. Since only one status byte value, 0xFF, is allowed for meta-messages, it does not need to be specified here. Calls to getStatus sample code for javax.sound.midi.MidiMessage.getStatus() definition code for javax.sound.midi.MidiMessage.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 the data byte array
Throws:
InvalidMidiDataException - if the parameter values do not specify a valid MIDI meta message
InvalidMidiDataException sample code for javax.sound.midi.InvalidMidiDataException definition code for javax.sound.midi.InvalidMidiDataException

getType sample code for javax.sound.midi.MetaMessage.getType() definition code for javax.sound.midi.MetaMessage.getType()

public int getType()
Obtains the type of the MetaMessage.

Returns:
an integer representing the MetaMessage type

getData sample code for javax.sound.midi.MetaMessage.getData() definition code for javax.sound.midi.MetaMessage.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() sample code for javax.sound.midi.MidiMessage.getLength() definition code for javax.sound.midi.MidiMessage.getLength()

clone sample code for javax.sound.midi.MetaMessage.clone() definition code for javax.sound.midi.MetaMessage.clone()

public Object sample code for java.lang.Object definition code for java.lang.Object  clone()
Creates a new object of the same class and with the same contents as this object.

Specified by:
clone sample code for javax.sound.midi.MidiMessage.clone() definition code for javax.sound.midi.MidiMessage.clone() in class MidiMessage sample code for javax.sound.midi.MidiMessage definition code for javax.sound.midi.MidiMessage
Returns:
a clone of this instance
See Also:
Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable