java类javax.sound.sampled.spi.MixerProvider的实例源码

JDK13Services.java 文件源码 项目:OpenJSharp 阅读 16 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:OpenJSharp 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
JDK13Services.java 文件源码 项目:jdk8u-jdk 阅读 19 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
JDK13Services.java 文件源码 项目:openjdk-jdk10 阅读 19 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Obtains the requested audio mixer.
 *
 * @param  info a {@code Mixer.Info} object representing the desired mixer,
 *         or {@code null} for the system default mixer
 * @return the requested mixer
 * @throws SecurityException if the requested mixer is unavailable because
 *         of security restrictions
 * @throws IllegalArgumentException if the info object does not represent a
 *         mixer installed on the system
 * @see #getMixerInfo
 */
public static Mixer getMixer(final Mixer.Info info) {
    for (final MixerProvider provider : getMixerProviders()) {
        try {
            return provider.getMixer(info);
        } catch (IllegalArgumentException | NullPointerException ignored) {
            // The MixerProvider.getMixer(null) should return default Mixer,
            // This behaviour was assumed from the beginning, but strictly
            // specified only in the jdk9. Since the jdk1.1.5 we skipped
            // NPE for some reason and therefore skipped some
            // implementations of MixerProviders, which throw NPE. To keep
            // support of such implementations, we still ignore NPE.
        }
    }
    throw new IllegalArgumentException(
            String.format("Mixer not supported: %s", info));
}
AudioSystem.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List.
 *
 * @param  providers The list of MixerProviders
 * @return a List of info objects for the currently installed mixers. If no
 *         mixers are available on the system, an empty List is returned.
 * @see #getMixerInfo()
 */
private static List<Mixer.Info> getMixerInfoList(List<MixerProvider> providers) {
    List<Mixer.Info> infos = new ArrayList<>();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = providers.get(i).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
DefaultMixers.java 文件源码 项目:openjdk-jdk10 阅读 19 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws Exception {
    boolean allOk = true;
    Mixer.Info[] infos;

    out("Testing Mixers retrieved via AudioSystem");
    infos = AudioSystem.getMixerInfo();
    allOk &= testMixers(infos, null);

    out("Testing MixerProviders");
    List providers = JDK13Services.getProviders(MixerProvider.class);
    for (int i = 0; i < providers.size(); i++) {
        MixerProvider provider = (MixerProvider) providers.get(i);
        infos = provider.getMixerInfo();
        allOk &= testMixers(infos, provider.getClass().getName());
    }

    if (! allOk) {
        throw new Exception("Test failed");
    } else {
        out("Test passed");
    }
}
JDK13Services.java 文件源码 项目:openjdk9 阅读 16 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:openjdk9 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Obtains the requested audio mixer.
 *
 * @param  info a {@code Mixer.Info} object representing the desired mixer,
 *         or {@code null} for the system default mixer
 * @return the requested mixer
 * @throws SecurityException if the requested mixer is unavailable because
 *         of security restrictions
 * @throws IllegalArgumentException if the info object does not represent a
 *         mixer installed on the system
 * @see #getMixerInfo
 */
public static Mixer getMixer(final Mixer.Info info) {
    for (final MixerProvider provider : getMixerProviders()) {
        try {
            return provider.getMixer(info);
        } catch (IllegalArgumentException | NullPointerException ignored) {
            // The MixerProvider.getMixer(null) should return default Mixer,
            // This behaviour was assumed from the beginning, but strictly
            // specified only in the jdk9. Since the jdk1.1.5 we skipped
            // NPE for some reason and therefore skipped some
            // implementations of MixerProviders, which throw NPE. To keep
            // support of such implementations, we still ignore NPE.
        }
    }
    throw new IllegalArgumentException(
            String.format("Mixer not supported: %s", info));
}
AudioSystem.java 文件源码 项目:openjdk9 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List.
 */
private static List<Mixer.Info> getMixerInfoList(List<MixerProvider> providers) {
    List<Mixer.Info> infos = new ArrayList<>();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = providers.get(i).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
AudioSystem.java 文件源码 项目:Java8CN 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
JDK13Services.java 文件源码 项目:jdk8u_jdk 阅读 16 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:jdk8u_jdk 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
JDK13Services.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 17 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
JDK13Services.java 文件源码 项目:infobip-open-jdk-8 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:infobip-open-jdk-8 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
JDK13Services.java 文件源码 项目:jdk8u-dev-jdk 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:jdk8u-dev-jdk 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
AudioSystem.java 文件源码 项目:jdk7-jdk 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
AudioSystem.java 文件源码 项目:openjdk-source-code-learn 阅读 24 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
AudioSystem.java 文件源码 项目:OLD-OpenJDK8 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
AudioSystem.java 文件源码 项目:cn1 阅读 20 收藏 0 点赞 0 评论 0
public static Line.Info[] getSourceLineInfo(Line.Info info) {
    List<Line.Info> result = new ArrayList<Line.Info>();
    for (Iterator providers = ProviderService.getProviders(
            mixerProviderPath).iterator(); providers.hasNext();) {
        try {
            MixerProvider pr = (MixerProvider) providers.next();
            Mixer.Info[] mixinfos = pr.getMixerInfo();
            for (Mixer.Info mixinfo : mixinfos) {
                Mixer mix = pr.getMixer(mixinfo);
                Line.Info[] linfos = mix.getSourceLineInfo(info);
                for (Line.Info linfo : linfos) {
                    result.add(linfo);
                }
            }
        } catch (ClassCastException e) {}
    }
    Line.Info[] temp = new Line.Info[result.size()];
    return result.toArray(temp);
}
AudioSystem.java 文件源码 项目:cn1 阅读 26 收藏 0 点赞 0 评论 0
public static Line.Info[] getTargetLineInfo(Line.Info info) {
    List<Line.Info> result = new ArrayList<Line.Info>();
    for (Iterator providers = ProviderService.getProviders(
            mixerProviderPath).iterator(); providers.hasNext();) {
        try {
            MixerProvider pr = (MixerProvider) providers.next();
            Mixer.Info[] mixinfos = pr.getMixerInfo();
            for (Mixer.Info mixinfo : mixinfos) {
                Mixer mix = pr.getMixer(mixinfo);
                Line.Info[] linfos = mix.getTargetLineInfo(info);
                for (Line.Info linfo : linfos) {
                    result.add(linfo);
                }
            }
        } catch (ClassCastException e) {}
    }
    Line.Info[] temp = new Line.Info[result.size()];
    return result.toArray(temp);
}
AudioSystem.java 文件源码 项目:cn1 阅读 22 收藏 0 点赞 0 评论 0
public static boolean isLineSupported(Line.Info info) {

        for (Iterator providers = ProviderService.getProviders(
                mixerProviderPath).iterator(); providers.hasNext();) {
            try {
                MixerProvider pr = (MixerProvider) providers.next();
                Mixer.Info[] mixinfos = pr.getMixerInfo();
                for (Mixer.Info mixinfo : mixinfos) {
                    Mixer mix = pr.getMixer(mixinfo);
                    if (mix.isLineSupported(info)) {
                        return true;
                    }
                }
            } catch (ClassCastException e) {}
        }
        return false;
    }
JDK13Services.java 文件源码 项目:openjdk-jdk7u-jdk 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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);
}
AudioSystem.java 文件源码 项目:openjdk-jdk7u-jdk 阅读 19 收藏 0 点赞 0 评论 0
/**
 * Like getMixerInfo, but return List
 */
private static List getMixerInfoList(List providers) {
    List infos = new ArrayList();

    Mixer.Info[] someInfos; // per-mixer
    Mixer.Info[] allInfos;  // for all mixers

    for(int i = 0; i < providers.size(); i++ ) {
        someInfos = (Mixer.Info[])
            ((MixerProvider)providers.get(i)).getMixerInfo();

        for (int j = 0; j < someInfos.length; j++) {
            infos.add(someInfos[j]);
        }
    }

    return infos;
}
AudioSystem.java 文件源码 项目:freeVM 阅读 24 收藏 0 点赞 0 评论 0
public static Line.Info[] getSourceLineInfo(Line.Info info) {
    List<Line.Info> result = new ArrayList<Line.Info>();
    for (Iterator providers = ProviderService.getProviders(
            mixerProviderPath).iterator(); providers.hasNext();) {
        try {
            MixerProvider pr = (MixerProvider) providers.next();
            Mixer.Info[] mixinfos = pr.getMixerInfo();
            for (Mixer.Info mixinfo : mixinfos) {
                Mixer mix = pr.getMixer(mixinfo);
                Line.Info[] linfos = mix.getSourceLineInfo(info);
                for (Line.Info linfo : linfos) {
                    result.add(linfo);
                }
            }
        } catch (ClassCastException e) {}
    }
    Line.Info[] temp = new Line.Info[result.size()];
    return result.toArray(temp);
}
AudioSystem.java 文件源码 项目:freeVM 阅读 23 收藏 0 点赞 0 评论 0
public static Line.Info[] getTargetLineInfo(Line.Info info) {
    List<Line.Info> result = new ArrayList<Line.Info>();
    for (Iterator providers = ProviderService.getProviders(
            mixerProviderPath).iterator(); providers.hasNext();) {
        try {
            MixerProvider pr = (MixerProvider) providers.next();
            Mixer.Info[] mixinfos = pr.getMixerInfo();
            for (Mixer.Info mixinfo : mixinfos) {
                Mixer mix = pr.getMixer(mixinfo);
                Line.Info[] linfos = mix.getTargetLineInfo(info);
                for (Line.Info linfo : linfos) {
                    result.add(linfo);
                }
            }
        } catch (ClassCastException e) {}
    }
    Line.Info[] temp = new Line.Info[result.size()];
    return result.toArray(temp);
}


问题


面经


文章

微信
公众号

扫码关注公众号