Java Code Examples for javax.sound.midi.MetaMessage#META
The following examples show how to use
javax.sound.midi.MetaMessage#META .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MidiUtils.java From Bytecoder with Apache License 2.0 | 6 votes |
/** 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; }
Example 2
Source File: MidiUtils.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** 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; }
Example 3
Source File: MidiUtils.java From Bytecoder with Apache License 2.0 | 5 votes |
/** 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); }
Example 4
Source File: MidiUtils.java From Bytecoder with Apache License 2.0 | 5 votes |
/** 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); }
Example 5
Source File: MidiUtils.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** 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); }
Example 6
Source File: MidiUtils.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** 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); }