当前位置: 首页>>代码示例>>Java>>正文


Java ShortMessage.ACTIVE_SENSING属性代码示例

本文整理汇总了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;

  }

}
 
开发者ID:DerekCook,项目名称:CoreMidi4J,代码行数:28,代码来源:CoreMidiSource.java

示例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;
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:54,代码来源:SoftMainMixer.java

示例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;
    }

}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:51,代码来源:SoftMainMixer.java

示例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);

  }

}
 
开发者ID:DerekCook,项目名称:CoreMidi4J,代码行数:60,代码来源:CoreMidiSource.java


注:本文中的javax.sound.midi.ShortMessage.ACTIVE_SENSING属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。