private static AudioFileFormat.Type getTargetType(String extension) { AudioFileFormat.Type[] typesSupported = AudioSystem.getAudioFileTypes(); for (AudioFileFormat.Type aTypesSupported : typesSupported) { if (aTypesSupported.getExtension().equals(extension)) { return aTypesSupported; } } return null; }
/** * TODO: */ public static void listSupportedTargetTypes() { StringBuilder strMessage = new StringBuilder("Supported target types:"); AudioFileFormat.Type[] aTypes = AudioSystem.getAudioFileTypes(); for (int i = 0; i < aTypes.length; i++) { strMessage.append(" ").append(aTypes[i].getExtension()); } out(strMessage.toString()); }
/** * TODO: */ public static void listSupportedTargetTypes() { StringBuilder strMessage = new StringBuilder("Supported target types:"); AudioFileFormat.Type[] aTypes = AudioSystem.getAudioFileTypes(); for (int i = 0; i < aTypes.length; i++) { strMessage.append(" ").append(aTypes[i].getExtension()); } out(strMessage.toString()); }
/** * Trying to get an audio file type for the passed extension. This works by examining all available file types. For each type, * if the extension this type promisses to handle matches the extension we are trying to find a type for, this type is * returned. If no appropriate type is found, null is returned. * * @param strExtension * strExtension * @return aTypes[i] */ public static AudioFileFormat.Type findTargetType(String strExtension) { AudioFileFormat.Type[] aTypes = AudioSystem.getAudioFileTypes(); for (int i = 0; i < aTypes.length; i++) { if (aTypes[i].getExtension().equals(strExtension)) { return aTypes[i]; } } return null; }
/** * Trying to get an audio file type for the passed extension. This works by examining all available file types. For each type, * if the extension this type promisses to handle matches the extension we are trying to find a type for, this type is * returned. If no appropriate type is found, null is returned. * * @param strExtension * str Extension * @return atypes[i] */ public static AudioFileFormat.Type findTargetType(String strExtension) { AudioFileFormat.Type[] aTypes = AudioSystem.getAudioFileTypes(); for (int i = 0; i < aTypes.length; i++) { if (aTypes[i].getExtension().equals(strExtension)) { return aTypes[i]; } } return null; }
/** * Trying to get an audio file type for the passed extension. This works by examining all available file types. For each type, * if the extension this type promisses to handle matches the extension we are trying to find a type for, this type is * returned. If no appropriate type is found, null is returned. * * @param strExtension * strExtension * @return aTypes[i] */ public static AudioFileFormat.Type findTargetType(String strExtension) { AudioFileFormat.Type[] aTypes = AudioSystem.getAudioFileTypes(); for (int i = 0; i < aTypes.length; i++) { if (aTypes[i].getExtension().equals(strExtension)) { return aTypes[i]; } } return null; }
/** * Trying to get an audio file type for the passed extension. This works by examining all available file types. For each type, * if the extension this type promisses to handle matches the extension we are trying to find a type for, this type is * returned. If no appropriate type is found, null is returned. * * @param strExtension * str Extension * @return atypes[i] */ public static AudioFileFormat.Type findTargetType(String strExtension) { AudioFileFormat.Type[] aTypes = AudioSystem.getAudioFileTypes(); for (int i = 0; i < aTypes.length; i++) { if (aTypes[i].getExtension().equals(strExtension)) { return aTypes[i]; } } return null; }
/** * TODO: */ public static void listSupportedTargetTypes() { String strMessage = "Supported target types:"; AudioFileFormat.Type[] aTypes = AudioSystem.getAudioFileTypes(); for (int i = 0; i < aTypes.length; i++) { strMessage += " " + aTypes[i].getExtension(); } out(strMessage); }
/** * TODO: */ public static void listSupportedTargetTypes() { String strMessage = "Supported target types:"; AudioFileFormat.Type[] aTypes = AudioSystem.getAudioFileTypes(); for (int i = 0; i < aTypes.length; i++) { strMessage += " " + aTypes[i].getExtension(); } out(strMessage); }
/** * List the available audio file format types, as a multi-line string. Each line consists of the name of an Audio file format * type, followed by a suffix "_FILE" if the format can be produced as a file, and "_STREAM" if the format can be streamed. * * @return a multi-line string, or an empty string if no audio file types are available. */ public static String getAudioFileFormatTypes() { StringBuilder output = new StringBuilder(); AudioFileFormat.Type[] audioTypes = AudioSystem.getAudioFileTypes(); for (int t = 0; t < audioTypes.length; t++) { AudioFileFormat.Type audioType = audioTypes[t]; String typeName = audioType.toString(); boolean isSupported = true; if (typeName.equals("MP3")) isSupported = canCreateMP3(); else if (typeName.equals("Vorbis")) isSupported = canCreateOgg(); audioType = MaryAudioUtils.getAudioFileFormatType(typeName); if (audioType == null) { isSupported = false; } if (isSupported && AudioSystem.isFileTypeSupported(audioType)) { output.append(typeName).append("_FILE\n"); if (typeName.equals("MP3") || typeName.equals("Vorbis")) output.append(typeName).append("_STREAM\n"); } } return output.toString(); }
/** * List the available audio file format types, as a multi-line string. Each line consists of the name of an Audio file format * type, followed by a suffix "_FILE" if the format can be produced as a file, and "_STREAM" if the format can be streamed. * * @return a multi-line string, or an empty string if no audio file types are available. */ public static String getAudioFileFormatTypes() { StringBuilder output = new StringBuilder(); AudioFileFormat.Type[] audioTypes = AudioSystem.getAudioFileTypes(); for (int t = 0; t < audioTypes.length; t++) { AudioFileFormat.Type audioType = audioTypes[t]; String typeName = audioType.toString(); boolean isSupported = true; if (typeName.equals("MP3")) isSupported = canCreateMP3(); else if (typeName.equals("Vorbis")) isSupported = canCreateOgg(); audioType = MaryAudioUtils.getAudioFileFormatType(typeName); if (audioType == null) { isSupported = false; } if (isSupported && AudioSystem.isFileTypeSupported(audioType)) { output.append(typeName).append("_FILE\n"); if (typeName.equals("MP3") || typeName.equals("Vorbis")) output.append(typeName).append("_STREAM\n"); } } return output.toString(); }
soundNode.add(soundSampledNode); md = new MediaData("Suffixes", "Sound File Suffixes", AudioSystem.getAudioFileTypes()); soundSampledNode.add(new DefaultMutableTreeNode(md));
private static AudioFileFormat.Type getTargetType(String extension) { AudioFileFormat.Type[] typesSupported = AudioSystem.getAudioFileTypes(); for (AudioFileFormat.Type aTypesSupported : typesSupported) { if (aTypesSupported.getExtension().equals(extension)) { return aTypesSupported; } } return null; }
/** * Returns the audio type based upon the extension of the given file * * @param file * the file of interest * * @return the audio type of the file or null if it is a non-supported type */ private static AudioFileFormat.Type getAudioType(String file) { AudioFileFormat.Type[] types = AudioSystem.getAudioFileTypes(); String extension = getExtension(file); for (int i = 0; i < types.length; i++) { if (types[i].getExtension().equals(extension)) { return types[i]; } } return null; }
/** * List the available audio file format types, as a multi-line string. Each line consists of the name of an Audio file format * type, followed by a suffix "_FILE" if the format can be produced as a file, and "_STREAM" if the format can be streamed. * * @return a multi-line string, or an empty string if no audio file types are available. */ public static String getAudioFileFormatTypes() { StringBuilder output = new StringBuilder(); AudioFileFormat.Type[] audioTypes = AudioSystem.getAudioFileTypes(); for (int t = 0; t < audioTypes.length; t++) { AudioFileFormat.Type audioType = audioTypes[t]; String typeName = audioType.toString(); boolean isSupported = true; if (typeName.equals("MP3")) isSupported = canCreateMP3(); else if (typeName.equals("Vorbis")) isSupported = canCreateOgg(); audioType = MaryAudioUtils.getAudioFileFormatType(typeName); if (audioType == null) { isSupported = false; } if (isSupported && AudioSystem.isFileTypeSupported(audioType)) { output.append(typeName).append("_FILE\n"); if (typeName.equals("MP3") || typeName.equals("Vorbis")) output.append(typeName).append("_STREAM\n"); } } return output.toString(); }
SwingUtilities.invokeLater(new Runnable() { public void run() { AudioFileFormat.Type[] formatTypes = AudioSystem.getAudioFileTypes(); String[] types = new String[formatTypes.length]; for(int ii=0; ii<types.length; ii++) {
System.out.println("Running"); System.out.println(System.getProperty("java.version")); final AudioFileFormat.Type [] types = AudioSystem.getAudioFileTypes(); for (final AudioFileFormat.Type t : types) { System.out.println("Returning Type : " + t);
soundNode.add(soundSampledNode); md = new MediaData("Suffixes", "Sound File Suffixes", AudioSystem.getAudioFileTypes()); soundSampledNode.add(new DefaultMutableTreeNode(md));