import javax.sound.sampled.TargetDataLine;
public class SoundTestAusgabeAllerGeraete {
public static void main(String[] args) {
System.out.println("Available:");
Mixer mixer = null;
Mixer.Info[] mixerinfos = AudioSystem.getMixerInfo();
for(int i=0; i<mixerinfos.length; i++)
{
mixer = AudioSystem.getMixer(mixerinfos[i]);
System.out.println("\n " + mixerinfos[i].getName() + " (Name: " + mixerinfos[i].getName() +
" / Vendor: " + mixerinfos[i].getVendor() + " / Version: " + mixerinfos[i].getVersion() + ")");
Line.Info[] sLineInfos = mixer.getSourceLineInfo();
System.out.println(" Sources (" + sLineInfos.length + "):");
for(int k=0; k<sLineInfos.length; k++)
{
try
{
SourceDataLine sLine = (SourceDataLine)mixer.getLine(sLineInfos[k]);
System.out.println(" Line: " + sLine.getLineInfo() + "\t(Name: " + sLine + ")");
}
catch (LineUnavailableException e)
{
e.printStackTrace();
}
catch(ClassCastException e)
{
try
{
Clip sClip = (Clip)mixer.getLine(sLineInfos[k]);
System.out.println(" Clip: " + sClip.getLineInfo() + "\t(Name: " + sClip + ")");
}
catch (LineUnavailableException e1)
{
e1.printStackTrace();
}
catch(ClassCastException e1)
{
try
{
Port sPort = (Port)mixer.getLine(sLineInfos[k]);
System.out.println(" Port: " + sPort.getLineInfo() + "\t(Name: " + sPort + ")");
}
catch (LineUnavailableException e2)
{
e2.printStackTrace();
}
}
}
}
Line.Info[] tLineInfos = mixer.getTargetLineInfo();
System.out.println(" Targets (" + tLineInfos.length + "):");
for(int k=0; k<tLineInfos.length; k++)
{
try
{
TargetDataLine tLine = (TargetDataLine)mixer.getLine(tLineInfos[k]);
System.out.println(" Line: " + tLine.getLineInfo() + "\t(Name: " + tLine + ")");
}
catch (LineUnavailableException e)
{
e.printStackTrace();
}
catch(ArrayIndexOutOfBoundsException e)
{
}
catch(ClassCastException e)
{
try
{
Clip tClip = (Clip)mixer.getLine(tLineInfos[k]);
System.out.println(" Clip: " + tClip.getLineInfo() + "\t(Name: " + tClip + ")");
}
catch (LineUnavailableException e1)
{
e1.printStackTrace();
}
catch(ClassCastException e1)
{
try
{
Port tPort = (Port)mixer.getLine(tLineInfos[k]);
System.out.println(" Port: " + tPort.getLineInfo() + "\t(Name: " + tPort + ")");
}
catch (LineUnavailableException e2)
{
e2.printStackTrace();