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

项目:sponge    文件:MidiUtils.java   
/**
 * Returns the default input MIDI device.
 *
 * @return the default input MIDI device or {@code null} if not found.
 */
public static MidiDevice getDefaultInputDevice() {
    try {
        Transmitter transmitter = MidiSystem.getTransmitter();

        if (transmitter != null && transmitter instanceof MidiDeviceTransmitter) {
            return ((MidiDeviceTransmitter) transmitter).getMidiDevice();
        }

        return null;
    } catch (MidiUnavailableException e) {
        throw SpongeUtils.wrapException(e);
    }
}