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


Java MidiDeviceProvider类代码示例

本文整理汇总了Java中javax.sound.midi.spi.MidiDeviceProvider的典型用法代码示例。如果您正苦于以下问题:Java MidiDeviceProvider类的具体用法?Java MidiDeviceProvider怎么用?Java MidiDeviceProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MidiDeviceProvider类属于javax.sound.midi.spi包,在下文中一共展示了MidiDeviceProvider类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getProviders

import javax.sound.midi.spi.MidiDeviceProvider; //导入依赖的package包/类
/**
 * Obtains a List containing installed instances of the providers for the
 * requested service. The returned List is immutable.
 *
 * @param serviceClass The type of providers requested. This should be one
 *                     of AudioFileReader.class, AudioFileWriter.class,
 *                     FormatConversionProvider.class, MixerProvider.class,
 *                     MidiDeviceProvider.class, MidiFileReader.class,
 *                     MidiFileWriter.class or SoundbankReader.class.
 *
 * @return A List of providers of the requested type. This List is
 *         immutable.
 */
public static List<?> getProviders(final Class<?> serviceClass) {
    final List<?> providers;
    if (!MixerProvider.class.equals(serviceClass)
            && !FormatConversionProvider.class.equals(serviceClass)
            && !AudioFileReader.class.equals(serviceClass)
            && !AudioFileWriter.class.equals(serviceClass)
            && !MidiDeviceProvider.class.equals(serviceClass)
            && !SoundbankReader.class.equals(serviceClass)
            && !MidiFileWriter.class.equals(serviceClass)
            && !MidiFileReader.class.equals(serviceClass)) {
        providers = new ArrayList<>(0);
    } else {
        providers = JSSecurityManager.getProviders(serviceClass);
    }
    return Collections.unmodifiableList(providers);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:JDK13Services.java

示例2: getNamedDevice

import javax.sound.midi.spi.MidiDeviceProvider; //导入依赖的package包/类
/** 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) {
    MidiDevice device;
    // try to get MIDI port
    device = getNamedDevice(deviceName, provider, deviceClass,
                             false, false);
    if (device != null) {
        return device;
    }

    if (deviceClass == Receiver.class) {
        // try to get Synthesizer
        device = getNamedDevice(deviceName, provider, deviceClass,
                                 true, false);
        if (device != null) {
            return device;
        }
    }

    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:MidiSystem.java

示例3: getFirstDevice

import javax.sound.midi.spi.MidiDeviceProvider; //导入依赖的package包/类
/** 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) {
    MidiDevice device;
    // try to get MIDI port
    device = getFirstDevice(provider, deviceClass,
                            false, false);
    if (device != null) {
        return device;
    }

    if (deviceClass == Receiver.class) {
        // try to get Synthesizer
        device = getFirstDevice(provider, deviceClass,
                                true, false);
        if (device != null) {
            return device;
        }
    }

    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:MidiSystem.java

示例4: getNamedDevice

import javax.sound.midi.spi.MidiDeviceProvider; //导入依赖的package包/类
/**
 * 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) {
    MidiDevice device;
    // try to get MIDI port
    device = getNamedDevice(deviceName, provider, deviceClass,
                             false, false);
    if (device != null) {
        return device;
    }

    if (deviceClass == Receiver.class) {
        // try to get Synthesizer
        device = getNamedDevice(deviceName, provider, deviceClass,
                                 true, false);
        if (device != null) {
            return device;
        }
    }

    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:MidiSystem.java

示例5: getFirstDevice

import javax.sound.midi.spi.MidiDeviceProvider; //导入依赖的package包/类
/**
 * 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) {
    MidiDevice device;
    // try to get MIDI port
    device = getFirstDevice(provider, deviceClass,
                            false, false);
    if (device != null) {
        return device;
    }

    if (deviceClass == Receiver.class) {
        // try to get Synthesizer
        device = getFirstDevice(provider, deviceClass,
                                true, false);
        if (device != null) {
            return device;
        }
    }

    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:MidiSystem.java

示例6: main

import javax.sound.midi.spi.MidiDeviceProvider; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    boolean allOk = true;
    MidiDevice.Info[] infos;

    out("\nTesting MidiDevices retrieved via MidiSystem");
    infos = MidiSystem.getMidiDeviceInfo();
    allOk &= testDevices(infos, null);

    out("\nTesting MidiDevices retrieved from MidiDeviceProviders");
    List providers = JDK13Services.getProviders(MidiDeviceProvider.class);
    for (int i = 0; i < providers.size(); i++) {
        MidiDeviceProvider provider = (MidiDeviceProvider)providers.get(i);
        infos = provider.getDeviceInfo();
        allOk &= testDevices(infos, provider.getClass().getName());
    }

    if (!allOk) {
        throw new Exception("Test failed");
    } else {
        out("Test passed");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:DefaultDevices.java

示例7: main

import javax.sound.midi.spi.MidiDeviceProvider; //导入依赖的package包/类
public static void main(final String[] args) {
    final MidiDevice.Info[] infos = MidiSystem.getMidiDeviceInfo();
    for (final MidiDeviceProvider mdp : load(MidiDeviceProvider.class)) {
        for (final MidiDevice.Info info : infos) {
            if (mdp.isDeviceSupported(info)) {
                if (mdp.getDevice(info) == null) {
                    throw new RuntimeException("MidiDevice is null");
                }
            } else {
                try {
                    mdp.getDevice(info);
                    throw new RuntimeException(
                            "IllegalArgumentException expected");
                } catch (final IllegalArgumentException ignored) {
                    // expected
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:UnsupportedInfo.java


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