package com.mindprod.example;
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Control;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.Line;
import javax.sound.sampled.Mixer;
import static java.lang.System.*;
/**
* Tells you what formats javax.sound.sampled classes supports on this machine.
*
* @author Roedy Green, Canadian Mind Products
* @version 1.0 2009-03-06 initial version
* @since 2009-03-06
*/
public class TestSoundSupport
{
/**
* display formats supported
*
* @param li the line information.
*/
private static void showFormats( Line.Info li )
{
if ( li instanceof DataLine.Info )
{
AudioFormat[] afs = ( ( DataLine.Info ) li ).getFormats();
for ( AudioFormat af : afs )
{
out.println( " " + af.toString() );
}
}
}
/**
* Tells you what formats javax.sound.sampled classes supports on this machine.
* Unfortunately, this is not as detailed as you need.
* You get get a much more detailed program from http://amug.org/~glguerin/other/AboutSound.zip
*
* @param args not used
*/
public static void main( String[] args )
{
Mixer.Info[] mis = AudioSystem.getMixerInfo();
for ( Mixer.Info mi : mis )
{
Mixer mixer = AudioSystem.getMixer( mi );
out.println( "mixer: " + mixer.getClass().getName() );
Line.Info[] lis = mixer.getSourceLineInfo();
for ( Line.Info li : lis )
{
out.println( " source line: " + li.toString() );
showFormats( li );
}
lis = mixer.getTargetLineInfo();
for ( Line.Info li : lis )
{
out.println( " target line: " + li.toString() );
showFormats( li );
}
Control[] cs = mixer.getControls();
for ( Control c : cs )
{
out.println( " control: " + c.toString() );
}
}
}
}