Java Code Examples for javax.sound.midi.spi.MidiDeviceProvider#getDeviceInfo()

The following examples show how to use javax.sound.midi.spi.MidiDeviceProvider#getDeviceInfo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MidiSystem.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/** Return a MidiDevice with a given name from a given MidiDeviceProvider.
  @param deviceName The name of the MidiDevice to be returned.
  @param provider The MidiDeviceProvider to check for MidiDevices.
  @param deviceClass The requested device type, one of Synthesizer.class,
  Sequencer.class, Receiver.class or Transmitter.class.

  @return A MidiDevice matching the requirements, or null if none is found.
 */
private static MidiDevice getNamedDevice(String deviceName,
                                         MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getName().equals(deviceName)) {
            MidiDevice device = provider.getDevice(infos[i]);
            if (isAppropriateDevice(device, deviceClass,
                                    allowSynthesizer, allowSequencer)) {
                return device;
            }
        }
    }
    return null;
}
 
Example 2
Source File: MidiSystem.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/** Return a MidiDevice with a given name from a given MidiDeviceProvider.
  @param deviceName The name of the MidiDevice to be returned.
  @param provider The MidiDeviceProvider to check for MidiDevices.
  @param deviceClass The requested device type, one of Synthesizer.class,
  Sequencer.class, Receiver.class or Transmitter.class.

  @return A MidiDevice matching the requirements, or null if none is found.
 */
private static MidiDevice getNamedDevice(String deviceName,
                                         MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getName().equals(deviceName)) {
            MidiDevice device = provider.getDevice(infos[i]);
            if (isAppropriateDevice(device, deviceClass,
                                    allowSynthesizer, allowSequencer)) {
                return device;
            }
        }
    }
    return null;
}
 
Example 3
Source File: MidiSystem.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Return a MidiDevice with a given name from a given MidiDeviceProvider.
  @param deviceName The name of the MidiDevice to be returned.
  @param provider The MidiDeviceProvider to check for MidiDevices.
  @param deviceClass The requested device type, one of Synthesizer.class,
  Sequencer.class, Receiver.class or Transmitter.class.

  @return A MidiDevice matching the requirements, or null if none is found.
 */
private static MidiDevice getNamedDevice(String deviceName,
                                         MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getName().equals(deviceName)) {
            MidiDevice device = provider.getDevice(infos[i]);
            if (isAppropriateDevice(device, deviceClass,
                                    allowSynthesizer, allowSequencer)) {
                return device;
            }
        }
    }
    return null;
}
 
Example 4
Source File: MidiSystem.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/** Return a MidiDevice with a given name from a given MidiDeviceProvider.
  @param deviceName The name of the MidiDevice to be returned.
  @param provider The MidiDeviceProvider to check for MidiDevices.
  @param deviceClass The requested device type, one of Synthesizer.class,
  Sequencer.class, Receiver.class or Transmitter.class.

  @return A MidiDevice matching the requirements, or null if none is found.
 */
private static MidiDevice getNamedDevice(String deviceName,
                                         MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getName().equals(deviceName)) {
            MidiDevice device = provider.getDevice(infos[i]);
            if (isAppropriateDevice(device, deviceClass,
                                    allowSynthesizer, allowSequencer)) {
                return device;
            }
        }
    }
    return null;
}
 
Example 5
Source File: MidiSystem.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/** Return a MidiDevice with a given name from a given MidiDeviceProvider.
  @param deviceName The name of the MidiDevice to be returned.
  @param provider The MidiDeviceProvider to check for MidiDevices.
  @param deviceClass The requested device type, one of Synthesizer.class,
  Sequencer.class, Receiver.class or Transmitter.class.

  @return A MidiDevice matching the requirements, or null if none is found.
 */
private static MidiDevice getNamedDevice(String deviceName,
                                         MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getName().equals(deviceName)) {
            MidiDevice device = provider.getDevice(infos[i]);
            if (isAppropriateDevice(device, deviceClass,
                                    allowSynthesizer, allowSequencer)) {
                return device;
            }
        }
    }
    return null;
}
 
Example 6
Source File: MidiSystem.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/** Return a MidiDevice with a given name from a given MidiDeviceProvider.
  @param deviceName The name of the MidiDevice to be returned.
  @param provider The MidiDeviceProvider to check for MidiDevices.
  @param deviceClass The requested device type, one of Synthesizer.class,
  Sequencer.class, Receiver.class or Transmitter.class.

  @return A MidiDevice matching the requirements, or null if none is found.
 */
private static MidiDevice getNamedDevice(String deviceName,
                                         MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getName().equals(deviceName)) {
            MidiDevice device = provider.getDevice(infos[i]);
            if (isAppropriateDevice(device, deviceClass,
                                    allowSynthesizer, allowSequencer)) {
                return device;
            }
        }
    }
    return null;
}
 
Example 7
Source File: MidiSystem.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/** Return a MidiDevice with a given name from a given MidiDeviceProvider.
  @param deviceName The name of the MidiDevice to be returned.
  @param provider The MidiDeviceProvider to check for MidiDevices.
  @param deviceClass The requested device type, one of Synthesizer.class,
  Sequencer.class, Receiver.class or Transmitter.class.

  @return A MidiDevice matching the requirements, or null if none is found.
 */
private static MidiDevice getNamedDevice(String deviceName,
                                         MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getName().equals(deviceName)) {
            MidiDevice device = provider.getDevice(infos[i]);
            if (isAppropriateDevice(device, deviceClass,
                                    allowSynthesizer, allowSequencer)) {
                return device;
            }
        }
    }
    return null;
}
 
Example 8
Source File: MidiSystem.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/** From a given MidiDeviceProvider, return the first appropriate device.
    @param provider The MidiDeviceProvider to check for MidiDevices.
    @param deviceClass The requested device type, one of Synthesizer.class,
    Sequencer.class, Receiver.class or Transmitter.class.
    @return A MidiDevice is considered appropriate, or null if no
    appropriate device is found.
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}
 
Example 9
Source File: MidiSystem.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/** From a given MidiDeviceProvider, return the first appropriate device.
    @param provider The MidiDeviceProvider to check for MidiDevices.
    @param deviceClass The requested device type, one of Synthesizer.class,
    Sequencer.class, Receiver.class or Transmitter.class.
    @return A MidiDevice is considered appropriate, or null if no
    appropriate device is found.
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}
 
Example 10
Source File: MidiSystem.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/** From a given MidiDeviceProvider, return the first appropriate device.
    @param provider The MidiDeviceProvider to check for MidiDevices.
    @param deviceClass The requested device type, one of Synthesizer.class,
    Sequencer.class, Receiver.class or Transmitter.class.
    @return A MidiDevice is considered appropriate, or null if no
    appropriate device is found.
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}
 
Example 11
Source File: MidiSystem.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains an array of information objects representing
 * the set of all MIDI devices available on the system.
 * A returned information object can then be used to obtain the
 * corresponding device object, by invoking
 * {@link #getMidiDevice(MidiDevice.Info) getMidiDevice}.
 *
 * @return an array of <code>MidiDevice.Info</code> objects, one
 * for each installed MIDI device.  If no such devices are installed,
 * an array of length 0 is returned.
 */
public static MidiDevice.Info[] getMidiDeviceInfo() {
    List allInfos = new ArrayList();
    List providers = getMidiDeviceProviders();

    for(int i = 0; i < providers.size(); i++) {
        MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
        MidiDevice.Info[] tmpinfo = provider.getDeviceInfo();
        for (int j = 0; j < tmpinfo.length; j++) {
            allInfos.add( tmpinfo[j] );
        }
    }
    MidiDevice.Info[] infosArray = (MidiDevice.Info[]) allInfos.toArray(new MidiDevice.Info[0]);
    return infosArray;
}
 
Example 12
Source File: MidiSystem.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains an array of information objects representing
 * the set of all MIDI devices available on the system.
 * A returned information object can then be used to obtain the
 * corresponding device object, by invoking
 * {@link #getMidiDevice(MidiDevice.Info) getMidiDevice}.
 *
 * @return an array of <code>MidiDevice.Info</code> objects, one
 * for each installed MIDI device.  If no such devices are installed,
 * an array of length 0 is returned.
 */
public static MidiDevice.Info[] getMidiDeviceInfo() {
    List allInfos = new ArrayList();
    List providers = getMidiDeviceProviders();

    for(int i = 0; i < providers.size(); i++) {
        MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
        MidiDevice.Info[] tmpinfo = provider.getDeviceInfo();
        for (int j = 0; j < tmpinfo.length; j++) {
            allInfos.add( tmpinfo[j] );
        }
    }
    MidiDevice.Info[] infosArray = (MidiDevice.Info[]) allInfos.toArray(new MidiDevice.Info[0]);
    return infosArray;
}
 
Example 13
Source File: MidiSystem.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * From a given MidiDeviceProvider, return the first appropriate device.
 *
 * @param  provider The MidiDeviceProvider to check for MidiDevices
 * @param  deviceClass The requested device type, one of Synthesizer.class,
 *         Sequencer.class, Receiver.class or Transmitter.class
 * @return A MidiDevice is considered appropriate, or null if no appropriate
 *         device is found
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class<?> deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}
 
Example 14
Source File: MidiSystem.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Obtains an array of information objects representing
 * the set of all MIDI devices available on the system.
 * A returned information object can then be used to obtain the
 * corresponding device object, by invoking
 * {@link #getMidiDevice(MidiDevice.Info) getMidiDevice}.
 *
 * @return an array of <code>MidiDevice.Info</code> objects, one
 * for each installed MIDI device.  If no such devices are installed,
 * an array of length 0 is returned.
 */
public static MidiDevice.Info[] getMidiDeviceInfo() {
    List allInfos = new ArrayList();
    List providers = getMidiDeviceProviders();

    for(int i = 0; i < providers.size(); i++) {
        MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
        MidiDevice.Info[] tmpinfo = provider.getDeviceInfo();
        for (int j = 0; j < tmpinfo.length; j++) {
            allInfos.add( tmpinfo[j] );
        }
    }
    MidiDevice.Info[] infosArray = (MidiDevice.Info[]) allInfos.toArray(new MidiDevice.Info[0]);
    return infosArray;
}
 
Example 15
Source File: MidiSystem.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** From a given MidiDeviceProvider, return the first appropriate device.
    @param provider The MidiDeviceProvider to check for MidiDevices.
    @param deviceClass The requested device type, one of Synthesizer.class,
    Sequencer.class, Receiver.class or Transmitter.class.
    @return A MidiDevice is considered appropriate, or null if no
    appropriate device is found.
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}
 
Example 16
Source File: MidiSystem.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** From a given MidiDeviceProvider, return the first appropriate device.
    @param provider The MidiDeviceProvider to check for MidiDevices.
    @param deviceClass The requested device type, one of Synthesizer.class,
    Sequencer.class, Receiver.class or Transmitter.class.
    @return A MidiDevice is considered appropriate, or null if no
    appropriate device is found.
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}
 
Example 17
Source File: MidiSystem.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** From a given MidiDeviceProvider, return the first appropriate device.
    @param provider The MidiDeviceProvider to check for MidiDevices.
    @param deviceClass The requested device type, one of Synthesizer.class,
    Sequencer.class, Receiver.class or Transmitter.class.
    @return A MidiDevice is considered appropriate, or null if no
    appropriate device is found.
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}
 
Example 18
Source File: MidiSystem.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** From a given MidiDeviceProvider, return the first appropriate device.
    @param provider The MidiDeviceProvider to check for MidiDevices.
    @param deviceClass The requested device type, one of Synthesizer.class,
    Sequencer.class, Receiver.class or Transmitter.class.
    @return A MidiDevice is considered appropriate, or null if no
    appropriate device is found.
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}
 
Example 19
Source File: MidiSystem.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Obtains an array of information objects representing
 * the set of all MIDI devices available on the system.
 * A returned information object can then be used to obtain the
 * corresponding device object, by invoking
 * {@link #getMidiDevice(MidiDevice.Info) getMidiDevice}.
 *
 * @return an array of <code>MidiDevice.Info</code> objects, one
 * for each installed MIDI device.  If no such devices are installed,
 * an array of length 0 is returned.
 */
public static MidiDevice.Info[] getMidiDeviceInfo() {
    List allInfos = new ArrayList();
    List providers = getMidiDeviceProviders();

    for(int i = 0; i < providers.size(); i++) {
        MidiDeviceProvider provider = (MidiDeviceProvider) providers.get(i);
        MidiDevice.Info[] tmpinfo = provider.getDeviceInfo();
        for (int j = 0; j < tmpinfo.length; j++) {
            allInfos.add( tmpinfo[j] );
        }
    }
    MidiDevice.Info[] infosArray = (MidiDevice.Info[]) allInfos.toArray(new MidiDevice.Info[0]);
    return infosArray;
}
 
Example 20
Source File: MidiSystem.java    From Bytecoder with Apache License 2.0 3 votes vote down vote up
/**
 * From a given MidiDeviceProvider, return the first appropriate device.
 *
 * @param  provider The MidiDeviceProvider to check for MidiDevices
 * @param  deviceClass The requested device type, one of Synthesizer.class,
 *         Sequencer.class, Receiver.class or Transmitter.class
 * @param  allowSynthesizer if true, Synthesizers are considered
 *         appropriate. Otherwise only pure MidiDevices are considered
 *         appropriate (unless allowSequencer is true). This flag only has
 *         an effect for deviceClass Receiver and Transmitter. For other
 *         device classes (Sequencer and Synthesizer), this flag has no
 *         effect.
 * @param  allowSequencer if true, Sequencers are considered appropriate.
 *         Otherwise only pure MidiDevices are considered appropriate
 *         (unless allowSynthesizer is true). This flag only has an effect
 *         for deviceClass Receiver and Transmitter. For other device
 *         classes (Sequencer and Synthesizer), this flag has no effect.
 * @return A MidiDevice is considered appropriate, or null if no appropriate
 *         device is found
 */
private static MidiDevice getFirstDevice(MidiDeviceProvider provider,
                                         Class<?> deviceClass,
                                         boolean allowSynthesizer,
                                         boolean allowSequencer) {
    MidiDevice.Info[] infos = provider.getDeviceInfo();
    for (int j = 0; j < infos.length; j++) {
        MidiDevice device = provider.getDevice(infos[j]);
        if (isAppropriateDevice(device, deviceClass,
                                allowSynthesizer, allowSequencer)) {
            return device;
        }
    }
    return null;
}