The tutorial http://download.oracle.com/javase/tutorial/sound/capturing.html does not cover how to choose a microphone.
I list faucets with the following code
System.out.println("Searching for microphones"); for(Mixer.Info mixerinfo : AudioSystem.getMixerInfo()) { mixer = AudioSystem.getMixer(mixerinfo); //System.out.println(mixerinfo.toString()); if( mixer.isLineSupported(Port.Info.MICROPHONE) ) { mixers.add(mixer); System.out.println(Integer.toString(mixers.size()) + ": " + mixerinfo.toString()); } }
i.e. by the presence of a microphone input. But next time, having a mixer, I canβt get a line to read.
If I use mixer.getTargetLineInfo() , I get an array from one Info , which when passed to mixer.getLine returns an object of type com.sun.media.sound.PortMixer$PortMixerPort , which is not duplicated.
If I use mixer.getTargetLines() , I get an empty array.
If I create my own DataLine.Info and pass it to the getLine mixer, I get an unsupported exception.
So what to do?
source share