Java 类javax.sound.midi.MidiDeviceReceiver 实例源码

项目:jdk8u-jdk    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:openjdk-jdk10    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:openjdk9    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:LaunchPad-MC    文件:LaunchPad.java   
private void init() throws MidiUnavailableException {
    devIn = MidiSystem.getMidiDevice(inInfo); devIn.open();
    devOut = MidiSystem.getMidiDevice(outInfo); devOut.open();
    midiIn = new MidiInput(); devIn.getTransmitter().setReceiver(midiIn);
    midiOut = (MidiDeviceReceiver)devOut.getReceiver();

    //MIDI Message Sender Thread:
    midiTx = new Thread(() -> { while(true) {
        int size; while((size=cue.size()) > 0) {
            MidiMessage msg; synchronized(this) { msg = cue.get(0); cue.remove(0); } midiOut.send(msg, -1);
            if(size > 10000) { //Keep array under 10,000...
                synchronized(this) { size=cue.size(); while(size > 50) { cue.remove(size-1); size--; }}
                debug("Buffer had to be force-cleared!");
            } if(Thread.interrupted()) return;
        } if(Thread.interrupted()) return;
    }}); midiTx.setPriority(1); midiTx.start();

    programMode(); setAll(-1); //Reset LaunchPad Lights.
}
项目:jdk8u_jdk    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:lookaside_java-1.8.0-openjdk    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:infobip-open-jdk-8    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:jdk8u-dev-jdk    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:jdk7-jdk    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:openjdk-source-code-learn    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:OLD-OpenJDK8    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:JAVA_UNIT    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:openjdk-jdk7u-jdk    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}
项目:openjdk-icedtea7    文件:SequencerImplicitSynthOpen.java   
static MidiDevice getConnectedDevice(Sequencer sequencer) {
    List<Transmitter> trans = sequencer.getTransmitters();
    log("  sequencer has " + trans.size() + " opened transmitters:");
    for (Transmitter tr: trans) {
        Receiver r = tr.getReceiver();
        log("    " + getClassStr(tr) + " connected to " + getClassStr(r));
        if (r instanceof MidiDeviceReceiver) {
            MidiDeviceReceiver recv = (MidiDeviceReceiver)r;
            MidiDevice dev = recv.getMidiDevice();
            log("      - receiver of " + getClassStr(dev));
            return dev;
        } else {
            log("      - does NOT implement MidiDeviceReceiver");
        }
    }
    return null;
}