public class MetaMessage extends MidiMessage
MetaMessage是一个MidiMessage , MidiMessage器没有意义,但可以存储在MIDI文件中并由音序器程序解释。
(参见MidiMessage类描述中的MidiMessage )。标准MIDI文件规范定义了各种类型的元事件,如序列号,歌词,提示点和设置速度。
还有诸如歌词,版权,速度指示,时间和键签名,标记等信息的元事件。有关更多信息,请参阅标准MIDI文件1.0规范,它是Complete MIDI 1.0详细规范的一部分,由“ MIDI制造商协会( http://www.midi.org )。
当数据正被使用MIDI线协议传送的,一与状态值ShortMessage0xFF表示系统重置消息。 在MIDI文件中,相同的状态值表示一个MetaMessage 。 元消息的类型通过状态字节0xFF之后的第一个字节0xFF 。 随后的字节是数据字节。 与系统专用信息,有数据字节的任意数量,这取决于类型MetaMessage 。
MetaEventListener
| Modifier and Type | Field and Description |
|---|---|
static int |
META
MetaMessage (0xFF或255)的状态字节,用于MIDI文件。
|
data, length| Modifier | Constructor and Description |
|---|---|
|
MetaMessage()
构建新的
MetaMessage 。
|
protected |
MetaMessage(byte[] data)
构造一个新的
MetaMessage 。
|
|
MetaMessage(int type, byte[] data, int length)
构造一个新的
MetaMessage并设置消息参数。
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
创建与该对象相同的类和新内容相同的新对象。
|
byte[] |
getData()
获取元消息的数据副本。
|
int |
getType()
获得
MetaMessage的类型。
|
void |
setMessage(int type, byte[] data, int length)
设置MetaMessage的消息
MetaMessage 。
|
getLength, getMessage, getStatus, setMessagepublic static final int META
MetaMessage (0xFF或255)的状态字节,用于MIDI文件。
它具有与SYSTEM_RESET相同的值,用于实时“MIDI线”协议。
public MetaMessage()
public MetaMessage(int type,
byte[] data,
int length)
throws InvalidMidiDataException
MetaMessage并设置消息参数。
可以使用setMessage方法更改消息的内容。
type - 元消息类型(必须小于128)
data - MIDI信息中的数据字节
length - data字节数组中的字节数;
它应该是非负的,小于等于data.length
InvalidMidiDataException - 如果参数值未指定有效的MIDI元消息
setMessage(int, byte[], int) ,
getType() ,
getData()
protected MetaMessage(byte[] data)
MetaMessage 。
data - 包含完整消息的字节数组。
可以使用setMessage方法更改消息数据。
setMessage(int, byte[], int)
public void setMessage(int type,
byte[] data,
int length)
throws InvalidMidiDataException
MetaMessage 。
由于元消息仅允许一个状态字节值0xFF ,因此不需要在此处指定。
致电getStatus返回0xFF为所有元消息。
type参数应该是type的状态字节后面的字节的MetaMessage 。 该data参数应包含的所有后续字节MetaMessage 。 换句话说,指定的类型的字节MetaMessage不被认为是一个数据字节。
type - 元消息类型(必须小于128)
data - MIDI信息中的数据字节
length -
data字节数组中的字节数
InvalidMidiDataException - 如果参数值没有指定有效的MIDI元消息
public int getType()
MetaMessage的类型。
MetaMessage类型的整数
public byte[] getData()
MidiMessage.getLength()
public Object clone()
clone在类别
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, 2014, Oracle and/or its affiliates. All rights reserved.