javax.sound.sampled.spi.MixerProvider Java Examples

The following examples show how to use javax.sound.sampled.spi.MixerProvider. 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: AudioSystem.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #2
Source File: AudioSystem.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: AudioSystem.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #4
Source File: JDK13Services.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #5
Source File: AudioSystem.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #6
Source File: AudioSystem.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #7
Source File: JDK13Services.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #8
Source File: AudioSystem.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #9
Source File: JDK13Services.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #10
Source File: DefaultMixers.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
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");
    }
}
 
Example #11
Source File: AudioSystem.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #12
Source File: AudioSystem.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #13
Source File: JDK13Services.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #14
Source File: AudioSystem.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #15
Source File: JDK13Services.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #16
Source File: AudioSystem.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #17
Source File: AudioSystem.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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));
}
 
Example #18
Source File: JDK13Services.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #19
Source File: AudioSystem.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #20
Source File: JDK13Services.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);
}
 
Example #21
Source File: AudioSystem.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #22
Source File: AudioSystem.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example #23
Source File: AudioSystem.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * 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;
}
 
Example #24
Source File: AudioSystem.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** 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;
}
 
Example #25
Source File: AudioSystem.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** 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;
}
 
Example #26
Source File: AudioSystem.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** 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;
}
 
Example #27
Source File: AudioSystem.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** 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;
}
 
Example #28
Source File: AudioSystem.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** From a List of MixerProviders, return a Mixer with a given name.
    This method never requires the returned Mixer to do mixing.
    @param mixerName The name of the Mixer to be returned.
    @param providers The List of MixerProviders 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,
                                   List providers,
                                   Line.Info info) {
    for(int i = 0; i < providers.size(); i++) {
        MixerProvider provider = (MixerProvider) providers.get(i);
        Mixer mixer = getNamedMixer(mixerName, provider, info);
        if (mixer != null) {
            return mixer;
        }
    }
    return null;
}
 
Example #29
Source File: AudioSystem.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #30
Source File: AudioSystem.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/** From a List of MixerProviders, return a Mixer with a given name.
    This method never requires the returned Mixer to do mixing.
    @param mixerName The name of the Mixer to be returned.
    @param providers The List of MixerProviders 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,
                                   List providers,
                                   Line.Info info) {
    for(int i = 0; i < providers.size(); i++) {
        MixerProvider provider = (MixerProvider) providers.get(i);
        Mixer mixer = getNamedMixer(mixerName, provider, info);
        if (mixer != null) {
            return mixer;
        }
    }
    return null;
}