Example usage for javax.sound.sampled Mixer getMaxLines

List of usage examples for javax.sound.sampled Mixer getMaxLines

Introduction

In this page you can find the example usage for javax.sound.sampled Mixer getMaxLines.

Prototype

int getMaxLines(Line.Info info);

Source Link

Document

Obtains the approximate maximum number of lines of the requested type that can be open simultaneously on the mixer.

Usage

From source file:SoundManagerTest.java

/**
 * Gets the maximum number of simultaneous sounds with the specified
 * AudioFormat that the default mixer can play.
 *//*from  ww  w . j  a  v  a  2  s  . co  m*/
public static int getMaxSimultaneousSounds(AudioFormat playbackFormat) {
    DataLine.Info lineInfo = new DataLine.Info(SourceDataLine.class, playbackFormat);
    Mixer mixer = AudioSystem.getMixer(null);
    return mixer.getMaxLines(lineInfo);
}