Doug -
I was looking into the same thing recently. Here is some sample code,
which will go through all mixers on the system and report any
targetdata lines available.
Mixer.Info[] aInfos = AudioSystem.getMixerInfo();
out("Available Mixers: " + aInfos.length);
for (int i = 0; i < aInfos.length; i++)
{
Mixer mixer = AudioSystem.getMixer(aInfos[i]);
Line.Info lineInfo = new Line.Info(DataLine.class);
System.out.println("Mixer " + i + ": " +
aInfos[i].getName() + " desc: " + aInfos[i].getDescription()
+ " vend: " + aInfos[i].getVendor()
+ " ver: " + aInfos[i].getVersion() );
if (mixer.isLineSupported(lineInfo))
{
Line.Info[] info = mixer.getTargetLineInfo(lineInfo);
for ( int j = 0; j < info.length; ++j )
{
AudioFormat af;
AudioFormat[] forms = ((DataLine.Info)
info[j]).getFormats();
for ( int n = 0; n < forms.length; ++n )
{
af = forms[n];
System.out.println(" " + af);
}
}
}
}
One thing I found interesting is, I have a USB headset. When I plug
it in, I get another mixer listed, with nearlly identical formats as
my Powerbook mic. I tried adding in my USB webcam as well. Same
result, another mixer with the same formats. Both USB devices list no
information about mixer name, vendor, version, etc. I don't know if
thats par for the course on other platforms.
HTH.
Regards,
Aaron R>
On 6/30/05, Doug Zwick <email@hidden> wrote:
> I'm trying to select specific devices for sound input
> using JavaSound. For example, I want to be able to pick
> from among the Line In, CD/DVD, USB mic, and the iSight's
> microphone. I tried:
>
> Line.Info[] list = AudioSystem.getTargetLineInfo(port);
>
> with port set to values like Port.Info.MICROPHONE,
> Port.Info.COMPACT_DISC, etc. but these return an empty
> list.
>
> If I pass in a DataLine.Info object specifying 44.1 KHz
> 16-bit stereo samples, I get back two lines. Is there any
> way of determining which physical device a particular
> instance will read from?
>
> What is the right way to do this? Am I missing something
> obvious? Is Java Sound on the Mac hardwired to only read
> from the default sound input source as configured in the
> System Preferences?
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Java-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/java-dev/email@hidden
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden