You can list all of the available Mixer objects using the following:
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
for (Mixer.Info mixerInfo : mixers){
System.out.println(mixerInfo);
}
On my system, a Mac, this is the result:
Java Sound Audio Engine, version 1.0
Built-in Input, version Unknown Version
Built-in Microphone, version Unknown Version
Edit
Here's how to extract a list of valid Target lines that you can get audio input from:
Mixer.Info[] mixers = AudioSystem.getMixerInfo();
List<Line.Info> availableLines = new ArrayList<Line.Info>();
for (Mixer.Info mixerInfo : mixers){
System.out.println("Found Mixer: " + mixerInfo);
Mixer m = AudioSystem.getMixer(mixerInfo);
Line.Info[] lines = m.getTargetLineInfo();
for (Line.Info li : lines){
System.out.println("Found target line: " + li);
try {
m.open();
availableLines.add(li);
} catch (LineUnavailableException e){
System.out.println("Line unavailable.");
}
}
}
System.out.println("Available lines: " + availableLines);
Once you have the Line.Info object, you can get the TargetDataLine associated with the Line.Info object by calling AudioSystem.getLine() and using that Line.Info as a parameter.