Java Code Examples for javax.sound.sampled.AudioSystem#getAudioFileTypes()

The following examples show how to use javax.sound.sampled.AudioSystem#getAudioFileTypes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AudioFileTypeUniqueness.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    boolean foundDuplicates = false;
    AudioFileFormat.Type[]  aTypes = AudioSystem.getAudioFileTypes();
    for (int i = 0; i < aTypes.length; i++)
    {
        for (int j = 0; j < aTypes.length; j++)
        {
            if (aTypes[i].equals(aTypes[j]) && i != j) {
                foundDuplicates = true;
            }
        }
    }
    if (foundDuplicates) {
        throw new Exception("Test failed");
    } else {
        System.out.println("Test passed");
    }
}
 
Example 2
Source File: MediaTools.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static void audioSystem() {
    Mixer.Info[] infos = AudioSystem.getMixerInfo();
    for (Mixer.Info info : infos) {
        logger.debug(info.getName() + " " + info.getVendor() + " " + info.getVersion() + " " + info.getDescription());
    }
    AudioFileFormat.Type[] formats = AudioSystem.getAudioFileTypes();
    logger.debug(Arrays.asList(formats));
}
 
Example 3
Source File: ShowAudioFileTypes.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    AudioFileFormat.Type[]  aTypes = AudioSystem.getAudioFileTypes();
    System.out.println(aTypes.length+" supported target types:");
    for (int i = 0; i < aTypes.length; i++)
    {
        System.out.println("  "+(i+1)+". " + aTypes[i]+" with ext. '"+aTypes[i].getExtension()+"'");
    }
    if (aTypes.length<3) {
        throw new Exception("Test failed");
    } else {
        System.out.println("Test passed");
    }
}
 
Example 4
Source File: MidiToAudioSettingsDialog.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public List<MidiToAudioFormat> getAvailableFormats(){
	List<MidiToAudioFormat> list = new ArrayList<MidiToAudioFormat>();
	AudioFormat srcFormat = MidiToAudioSettings.DEFAULT_FORMAT;
	AudioFormat.Encoding[] encodings = AudioSystem.getTargetEncodings(srcFormat);
	for( int i = 0 ; i < encodings.length ; i ++ ){
		AudioFormat dstFormat = new AudioFormat(encodings[i],srcFormat.getSampleRate(),srcFormat.getSampleSizeInBits(),srcFormat.getChannels(),srcFormat.getFrameSize(),srcFormat.getFrameRate(),srcFormat.isBigEndian());
		AudioInputStream dstStream = new AudioInputStream(null, dstFormat, 0);
		AudioFileFormat.Type[] dstTypes = AudioSystem.getAudioFileTypes(dstStream);
		if( dstTypes.length > 0 ){
			list.add( new MidiToAudioFormat( dstFormat , dstTypes ));
		}
	}
	return list;
}
 
Example 5
Source File: TGSynthSettingsDialog.java    From tuxguitar with GNU Lesser General Public License v2.1 5 votes vote down vote up
public List<MidiToAudioFormat> getAvailableFormats(){
	List<MidiToAudioFormat> list = new ArrayList<MidiToAudioFormat>();
	AudioFormat srcFormat = TGSynthAudioSettings.DEFAULT_FORMAT;
	AudioFormat.Encoding[] encodings = AudioSystem.getTargetEncodings(srcFormat);
	for( int i = 0 ; i < encodings.length ; i ++ ){
		AudioFormat dstFormat = new AudioFormat(encodings[i],srcFormat.getSampleRate(),srcFormat.getSampleSizeInBits(),srcFormat.getChannels(),srcFormat.getFrameSize(),srcFormat.getFrameRate(),srcFormat.isBigEndian());
		AudioInputStream dstStream = new AudioInputStream(null, dstFormat, 0);
		AudioFileFormat.Type[] dstTypes = AudioSystem.getAudioFileTypes(dstStream);
		if( dstTypes.length > 0 ){
			list.add( new MidiToAudioFormat( dstFormat , dstTypes ));
		}
	}
	return list;
}