本文整理汇总了Java中javax.sound.midi.ShortMessage.STOP属性的典型用法代码示例。如果您正苦于以下问题:Java ShortMessage.STOP属性的具体用法?Java ShortMessage.STOP怎么用?Java ShortMessage.STOP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.sound.midi.ShortMessage
的用法示例。
在下文中一共展示了ShortMessage.STOP属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isRealTimeMessage
/**
* Checks whether a status byte represents a real-time message, which can occur even in the middle of another
* multi-byte message.
*
* @param status the status byte which has just been received.
*
* @return true if the status byte represents a standalone real-time message which should be passed on without
* interrupting any other message being gathered.
*/
private boolean isRealTimeMessage(byte status) {
switch ( status ) {
case (byte) ShortMessage.TIMING_CLOCK:
case (byte) ShortMessage.START:
case (byte) ShortMessage.CONTINUE:
case (byte) ShortMessage.STOP:
case (byte) ShortMessage.ACTIVE_SENSING:
case (byte) ShortMessage.SYSTEM_RESET:
return true;
default:
return false;
}
}
示例2: expectedDataLength
/**
* Determine how many data bytes are expected for a given MIDI message other than a SYSEX message, which varies.
*
* @param status the status byte introducing the MIDI message.
*
* @return the number of data bytes which must be received for the message to be complete.
*
* @throws InvalidMidiDataException if the status byte is not valid.
*/
private int expectedDataLength (byte status) throws InvalidMidiDataException {
// system common and system real-time messages
switch( status &0xFF ) {
case ShortMessage.TUNE_REQUEST:
case ShortMessage.END_OF_EXCLUSIVE:
// System real-time messages
case ShortMessage.TIMING_CLOCK:
case 0xF9: // Undefined
case ShortMessage.START:
case ShortMessage.CONTINUE:
case ShortMessage.STOP:
case 0xFD: // Undefined
case ShortMessage.ACTIVE_SENSING:
case ShortMessage.SYSTEM_RESET:
return 0;
case ShortMessage.MIDI_TIME_CODE:
case ShortMessage.SONG_SELECT:
return 1;
case ShortMessage.SONG_POSITION_POINTER:
return 2;
default: // Fall through to next switch
}
// channel voice and mode messages
switch( status & 0xF0 ) {
case ShortMessage.NOTE_OFF:
case ShortMessage.NOTE_ON:
case ShortMessage.POLY_PRESSURE:
case ShortMessage.CONTROL_CHANGE:
case ShortMessage.PITCH_BEND:
return 2;
case ShortMessage.PROGRAM_CHANGE:
case ShortMessage.CHANNEL_PRESSURE:
return 1;
default:
throw new InvalidMidiDataException("Invalid status byte: " + status);
}
}