print Sound Mixer Info - Java javax.sound.sampled

Java examples for javax.sound.sampled:Sound

Description

print Sound Mixer Info

Demo Code


//package com.java2s;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;

import javax.sound.sampled.DataLine;

import javax.sound.sampled.Mixer;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;

public class Main {
    private static void printMixerInfo(Mixer.Info[] mixerInfos,
            AudioFormat format) {
        int i = 0;
        for (Mixer.Info info : mixerInfos) {
            System.out.println("Mixer " + i);
            System.out.println(info.getName());
            System.out.println(info.getVendor());
            System.out.println(info.getVersion());
            System.out.println(info.getDescription());

            Mixer mixer = AudioSystem.getMixer(info);
            DataLine.Info targetLineInfo = new DataLine.Info(
                    TargetDataLine.class, format);
            printMaxLines(mixer, targetLineInfo);

            DataLine.Info sourceLineInfo = new DataLine.Info(
                    SourceDataLine.class, format);
            printMaxLines(mixer, sourceLineInfo);

            System.out.println();

            i++;/*from  w  ww.j a v a 2  s.c om*/
        }
    }

    private static void printMaxLines(Mixer mixer, DataLine.Info lineInfo) {
        System.out.println("Max " + lineInfo.getLineClass().getName()
                + " lines:" + mixer.getMaxLines(lineInfo));
    }
}

Related Tutorials