本文整理匯總了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);
}