Package audio

Source Code of audio.SoundMicroTest4

package audio;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.BooleanControl;
import javax.sound.sampled.Control;
import javax.sound.sampled.FloatControl;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.Port;
import javax.sound.sampled.Mixer.Info;

public class SoundMicroTest4 {
  public static void main(String[] args) throws LineUnavailableException {
    Port lineIn = null;
    FloatControl volCtrl = null;
    Mixer mixer = null;

    Mixer.Info[] mixerInfoPool = AudioSystem.getMixerInfo();
    for (int i = 0; i < mixerInfoPool.length; i++) {
      Info info = mixerInfoPool[i];

      mixer = AudioSystem.getMixer(info);
      final int maxLines = mixer.getMaxLines(Port.Info.MICROPHONE);
      if (maxLines > 0) {
        System.out.println(info);
        lineIn = (Port) mixer.getLine(Port.Info.MICROPHONE);
        lineIn.open();
        Control[] controls = lineIn.getControls();
        for (int j = 0; j < controls.length; j++) {
          Control control = controls[j];
          System.out.println(control);
        }
//        volCtrl = (FloatControl) lineIn
//            .getControl(FloatControl.Type.VOLUME);
      }
    }

  }
}
TOP

Related Classes of audio.SoundMicroTest4

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.