Java Code Examples for javax.sound.sampled.spi.MixerProvider#getMixer()

The following examples show how to use javax.sound.sampled.spi.MixerProvider#getMixer() . 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 jdk8u-jdk 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 2
Source File: AudioSystem.java    From hottub 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 3
Source File: AudioSystem.java    From openjdk-jdk9 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 4
Source File: AudioSystem.java    From jdk8u-jdk 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 5
Source File: AudioSystem.java    From jdk8u_jdk 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 6
Source File: AudioSystem.java    From Bytecoder with Apache License 2.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 7
Source File: AudioSystem.java    From Java8CN with Apache License 2.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 8
Source File: AudioSystem.java    From openjdk-jdk8u-backup 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 9
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 10
Source File: AudioSystem.java    From openjdk-jdk8u 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 11
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 12
Source File: AudioSystem.java    From JDKSourceCode1.8 with MIT License 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 13
Source File: AudioSystem.java    From jdk8u-jdk 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 14
Source File: ExpectedNPEOnNull.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Tests the MixerProvider API directly.
 */
private static void testMP(MixerProvider mp) {
    try {
        mp.isMixerSupported(null);
        throw new RuntimeException("NPE is expected: " + mp);
    } catch (final NullPointerException ignored) {

    }
    try {
        mp.getMixer(null); // null should be accepted
    } catch (SecurityException | IllegalArgumentException e) {
        // skip the specified exceptions only
    }
}
 
Example 15
Source File: AudioSystem.java    From jdk8u60 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 16
Source File: AudioSystem.java    From jdk8u_jdk 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 17
Source File: AudioSystem.java    From TencentKona-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 18
Source File: AudioSystem.java    From openjdk-8-source 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 19
Source File: AudioSystem.java    From dragonwell8_jdk 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 20
Source File: AudioSystem.java    From jdk1.8-source-analysis with Apache License 2.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;
}