本文整理汇总了Java中javax.sound.midi.ShortMessage.ACTIVE_SENSING属性的典型用法代码示例。如果您正苦于以下问题:Java ShortMessage.ACTIVE_SENSING属性的具体用法?Java ShortMessage.ACTIVE_SENSING怎么用?Java ShortMessage.ACTIVE_SENSING使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.sound.midi.ShortMessage
的用法示例。
在下文中一共展示了ShortMessage.ACTIVE_SENSING属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: processMessage
public void processMessage(int ch, int cmd, int data1, int data2) {
synchronized (synth.control_mutex) {
activity();
}
if (cmd == 0xF0) {
int status = cmd | ch;
switch (status) {
case ShortMessage.ACTIVE_SENSING:
synchronized (synth.control_mutex) {
active_sensing_on = true;
}
break;
default:
break;
}
return;
}
SoftChannel[] channels = synth.channels;
if (ch >= channels.length)
return;
SoftChannel softchannel = channels[ch];
switch (cmd) {
case ShortMessage.NOTE_ON:
if(delay_midievent != 0)
softchannel.noteOn(data1, data2, delay_midievent);
else
softchannel.noteOn(data1, data2);
break;
case ShortMessage.NOTE_OFF:
softchannel.noteOff(data1, data2);
break;
case ShortMessage.POLY_PRESSURE:
softchannel.setPolyPressure(data1, data2);
break;
case ShortMessage.CONTROL_CHANGE:
softchannel.controlChange(data1, data2);
break;
case ShortMessage.PROGRAM_CHANGE:
softchannel.programChange(data1);
break;
case ShortMessage.CHANNEL_PRESSURE:
softchannel.setChannelPressure(data1);
break;
case ShortMessage.PITCH_BEND:
softchannel.setPitchBend(data1 + data2 * 128);
break;
default:
break;
}
}
示例3: processMessage
public void processMessage(int ch, int cmd, int data1, int data2) {
synchronized (synth.control_mutex) {
activity();
}
if (cmd == 0xF0) {
int status = cmd | ch;
switch (status) {
case ShortMessage.ACTIVE_SENSING:
synchronized (synth.control_mutex) {
active_sensing_on = true;
}
break;
default:
break;
}
return;
}
SoftChannel[] channels = synth.channels;
if (ch >= channels.length)
return;
SoftChannel softchannel = channels[ch];
switch (cmd) {
case ShortMessage.NOTE_ON:
softchannel.noteOn(data1, data2);
break;
case ShortMessage.NOTE_OFF:
softchannel.noteOff(data1, data2);
break;
case ShortMessage.POLY_PRESSURE:
softchannel.setPolyPressure(data1, data2);
break;
case ShortMessage.CONTROL_CHANGE:
softchannel.controlChange(data1, data2);
break;
case ShortMessage.PROGRAM_CHANGE:
softchannel.programChange(data1);
break;
case ShortMessage.CHANNEL_PRESSURE:
softchannel.setChannelPressure(data1);
break;
case ShortMessage.PITCH_BEND:
softchannel.setPitchBend(data1 + data2 * 128);
break;
default:
break;
}
}
示例4: 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);
}
}