• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MixerProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getProviders

import javax.sound.sampled.spi.MixerProvider; //导入依赖的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: getMixerInfoList

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:21,代码来源:AudioSystem.java


示例3: getMixer

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
/**
 * 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));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:AudioSystem.java


示例4: getMixerInfoList

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:AudioSystem.java


示例5: main

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
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");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:DefaultMixers.java


示例6: getMixerInfoList

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:20,代码来源:AudioSystem.java


示例7: getSourceLineInfo

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:AudioSystem.java


示例8: getTargetLineInfo

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
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);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:20,代码来源:AudioSystem.java


示例9: isLineSupported

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
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;
    }
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:AudioSystem.java


示例10: getNamedProvider

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
/** Return a MixerProvider of a given class from the list of
    MixerProviders.

    This method never requires the returned Mixer to do mixing.
    @param providerClassName The class name of the provider to be returned.
    @param providers The list of MixerProviders that is searched.
    @return A MixerProvider of the requested class, or null if none is
    found.
 */
private static MixerProvider getNamedProvider(String providerClassName,
                                              List providers) {
    for(int i = 0; i < providers.size(); i++) {
        MixerProvider provider = (MixerProvider) providers.get(i);
        if (provider.getClass().getName().equals(providerClassName)) {
            return provider;
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:AudioSystem.java


示例11: getNamedMixer

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
/** Return a Mixer with a given name from a given MixerProvider.
  This method never requires the returned Mixer to do mixing.
  @param mixerName The name of the Mixer to be returned.
  @param provider The MixerProvider to check for Mixers.
  @param info The type of line the returned Mixer is required to
  support.

  @return A Mixer matching the requirements, or null if none is found.
 */
private static Mixer getNamedMixer(String mixerName,
                                   MixerProvider provider,
                                   Line.Info info) {
    Mixer.Info[] infos = provider.getMixerInfo();
    for (int i = 0; i < infos.length; i++) {
        if (infos[i].getName().equals(mixerName)) {
            Mixer mixer = provider.getMixer(infos[i]);
            if (isAppropriateMixer(mixer, info, false)) {
                return mixer;
            }
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:AudioSystem.java


示例12: getFirstMixer

import javax.sound.sampled.spi.MixerProvider; //导入依赖的package包/类
/** From a given MixerProvider, return the first appropriate Mixer.
    @param provider The MixerProvider to check for Mixers.
    @param info The type of line the returned Mixer is required to
    support.
    @param isMixingRequired If true, only Mixers that support mixing are
    returned for line types of SourceDataLine and Clip.

    @return A Mixer that is considered appropriate, or null
    if none is found.
 */
private static Mixer getFirstMixer(MixerProvider provider,
                                   Line.Info info,
                                   boolean isMixingRequired) {
    Mixer.Info[] infos = provider.getMixerInfo();
    for (int j = 0; j < infos.length; j++) {
        Mixer mixer = provider.getMixer(infos[j]);
        if (isAppropriateMixer(mixer, info, isMixingRequired)) {
            return mixer;
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:23,代码来源:AudioSystem.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DatasetChangeEvent类代码示例发布时间:2022-05-21
下一篇:
Java MasterCoprocessorHost类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap