本文整理汇总了Java中javax.sound.midi.MetaMessage.META属性的典型用法代码示例。如果您正苦于以下问题:Java MetaMessage.META属性的具体用法?Java MetaMessage.META怎么用?Java MetaMessage.META使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.sound.midi.MetaMessage
的用法示例。
在下文中一共展示了MetaMessage.META属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTempoMPQ
/** parses this message for a META tempo message and returns
* the tempo in MPQ, or -1 if this isn't a tempo message
*/
public static int getTempoMPQ(MidiMessage midiMsg) {
// first check if it is a META message at all
if (midiMsg.getLength() != 6
|| midiMsg.getStatus() != MetaMessage.META) {
return -1;
}
byte[] msg = midiMsg.getMessage();
if (((msg[1] & 0xFF) != META_TEMPO_TYPE) || (msg[2] != 3)) {
return -1;
}
int tempo = (msg[5] & 0xFF)
| ((msg[4] & 0xFF) << 8)
| ((msg[3] & 0xFF) << 16);
return tempo;
}
示例2: isMetaEndOfTrack
/** return true if the passed message is Meta End Of Track */
public static boolean isMetaEndOfTrack(MidiMessage midiMsg) {
// first check if it is a META message at all
if (midiMsg.getLength() != 3
|| midiMsg.getStatus() != MetaMessage.META) {
return false;
}
// now get message and check for end of track
byte[] msg = midiMsg.getMessage();
return ((msg[1] & 0xFF) == META_END_OF_TRACK_TYPE) && (msg[2] == 0);
}
示例3: isMetaTempo
/** return if the given message is a meta tempo message */
public static boolean isMetaTempo(MidiMessage midiMsg) {
// first check if it is a META message at all
if (midiMsg.getLength() != 6
|| midiMsg.getStatus() != MetaMessage.META) {
return false;
}
// now get message and check for tempo
byte[] msg = midiMsg.getMessage();
// meta type must be 0x51, and data length must be 3
return ((msg[1] & 0xFF) == META_TEMPO_TYPE) && (msg[2] == 3);
}