title: How to get system audio setting by using Java
body: <p>I implemented a stand alone applet base  application for recording voice.I am able to know that microphone is attached or not but In case of user has set Internal  microphone and also attached head phone(external) with system then my application can't recognize that which microphone is selected and user start recording through head phone and voice couldn't be capture in this case.so i want to notify user through message please set external microphone setting in your system. 
  So please help me how to know which microphone is using by system.
  Here is the code to check that microphone is attached of not:-</p>
  
  <pre><code>public static boolean checkMicrophone()
  
  {
      AudioFormat format=null;
              TargetDataLine tline;
      format = new AudioFormat( AudioFormat.Encoding.PCM_SIGNED, 44100.0F, 16, 2,4, 44100.0F, false);
      Mixer.Info[] allMixer = AudioSystem.getMixerInfo();
      boolean lineFound = false;
      DataLine.Info info = new DataLine.Info(TargetDataLine.class, format); 
      try{
                  tline = (TargetDataLine) AudioSystem.getLine(info);
          lineFound=true;
              }catch(Exception e){
  
              }
  
      if(lineFound)
  
          return true;
  
      else
          return false;
  
  
  
  }
  </code></pre>