Example usage for javax.sound.midi MidiDevice getMaxTransmitters

List of usage examples for javax.sound.midi MidiDevice getMaxTransmitters

Introduction

In this page you can find the example usage for javax.sound.midi MidiDevice getMaxTransmitters.

Prototype

int getMaxTransmitters();

Source Link

Document

Obtains the maximum number of MIDI OUT connections available on this MIDI device for transmitting MIDI data.

Usage

From source file:org.monome.pages.configuration.Configuration.java

/**
 * Enables or disables a MIDI input device
 * /*from www .  j  a  v a  2  s  .co m*/
 * @param sMidiDevice The name of the MIDI device to toggle
 */
public void actionAddMidiInput(String sMidiDevice) {
    Info[] midiInfo = MidiSystem.getMidiDeviceInfo();
    MidiDevice midiDevice;

    for (int i = 0; i < midiInfo.length; i++) {
        try {
            midiDevice = MidiSystem.getMidiDevice(midiInfo[i]);
            if (sMidiDevice.compareTo(midiDevice.getDeviceInfo().toString()) == 0) {
                if (midiDevice.getMaxTransmitters() != 0) {
                    MidiDeviceFactory.toggleMidiInDevice(midiDevice);
                }
            }
        } catch (MidiUnavailableException e) {
            e.printStackTrace();
        }
    }
}