if (targetType == null) { out("target type '" + strExtension + "' is not supported."); out("using default type '" + DEFAULT_TARGET_TYPE.getExtension() + "'"); targetType = DEFAULT_TARGET_TYPE; out("using default type '" + DEFAULT_TARGET_TYPE.getExtension() + "'"); targetType = DEFAULT_TARGET_TYPE;
/** * Return an audio file format type for the given string. In addition to the built-in types, this can deal with MP3 supported * by tritonus. * * @param name * name * @return the audio file format type if it is known, or null. */ public static AudioFileFormat.Type getAudioFileFormatType(String name) { AudioFileFormat.Type at; if (name.equals("MP3")) { // Supported by tritonus plugin at = new AudioFileFormat.Type("MP3", "mp3"); } else if (name.equals("Vorbis")) { // supported by tritonus plugin at = new AudioFileFormat.Type("Vorbis", "ogg"); } else { try { at = (AudioFileFormat.Type) AudioFileFormat.Type.class.getField(name).get(null); } catch (Exception e) { return null; } } return at; }
MaryHttpServerUtils.errorWrongQueryParameterValue(response, "AUDIO", queryItems.get("AUDIO"), null); return; } else if (audioFileFormatType.toString().equals("MP3") && !MaryRuntimeUtils.canCreateMP3()) { MaryHttpServerUtils.errorWrongQueryParameterValue(response, "AUDIO", queryItems.get("AUDIO"), "Conversion to MP3 not supported."); return; } else if (audioFileFormatType.toString().equals("Vorbis") && !MaryRuntimeUtils.canCreateOgg()) { MaryHttpServerUtils.errorWrongQueryParameterValue(response, "AUDIO", queryItems.get("AUDIO"), "Conversion to OGG Vorbis format not supported."); if (audioFileFormatType.toString().equals("MP3")) { audioFormat = MaryRuntimeUtils.getMP3AudioFormat(); } else if (audioFileFormatType.toString().equals("Vorbis")) { audioFormat = MaryRuntimeUtils.getOggAudioFormat(); } else if (voice != null) {
MaryHttpServerUtils.errorWrongQueryParameterValue(response, "AUDIO", queryItems.get("AUDIO"), null); return; } else if (audioFileFormatType.toString().equals("MP3") && !MaryRuntimeUtils.canCreateMP3()) { MaryHttpServerUtils.errorWrongQueryParameterValue(response, "AUDIO", queryItems.get("AUDIO"), "Conversion to MP3 not supported."); return; } else if (audioFileFormatType.toString().equals("Vorbis") && !MaryRuntimeUtils.canCreateOgg()) { MaryHttpServerUtils.errorWrongQueryParameterValue(response, "AUDIO", queryItems.get("AUDIO"), "Conversion to OGG Vorbis format not supported."); if (audioFileFormatType.toString().equals("MP3")) { audioFormat = MaryRuntimeUtils.getMP3AudioFormat(); } else if (audioFileFormatType.toString().equals("Vorbis")) { audioFormat = MaryRuntimeUtils.getOggAudioFormat(); } else if (voice != null) {
if (audioFileFormatType.toString().equals("MP3")) { if (!MaryRuntimeUtils.canCreateMP3()) { throw new UnsupportedAudioFileException("Conversion to MP3 not supported."); } else if (audioFileFormatType.toString().equals("Vorbis")) { if (!MaryRuntimeUtils.canCreateOgg()) { throw new UnsupportedAudioFileException("Conversion to OGG Vorbis format not supported.");
boolean bIsAifc = m_FileType.equals(AudioFileFormat.Type.AIFC); long lLength = getLength(); TDataOutputStream dos = getDataOutputStream();
system.error("AudioRecorder.save: Can't write " + type.toString() + " using format " + format.toString() + ".");
String[] types = new String[formatTypes.length]; for(int ii=0; ii<types.length; ii++) { types[ii] = formatTypes[ii].getExtension();
info.append("\", style \"" + this.defaultStyle); if (audioFileFormat != null) info.append("\", audio \"" + audioFileFormat.getType().toString() + "\""); if (streamAudio) info.append(", streaming");
debug("createRecorder: file extension is " + ext + "."); AudioFileFormat.Type fileType = null; if (ext.equals(Minim.WAV.getExtension())) else if (ext.equals(Minim.AIFF.getExtension()) || ext.equals("aif")) else if (ext.equals(Minim.AIFC.getExtension())) else if (ext.equals(Minim.AU.getExtension())) else if (ext.equals(Minim.SND.getExtension()))
format = AudioSystem.getAudioFileFormat(new ByteArrayInputStream(_data)) .getType().getExtension(); } catch (UnsupportedAudioFileException ex) { format = getFormatByName(_name); try { format = AudioSystem.getAudioFileFormat(_file) .getType().getExtension(); } catch (UnsupportedAudioFileException ex) { format = getFormatByName(_name); try { format = AudioSystem.getAudioFileFormat(_url) .getType().getExtension(); } catch (UnsupportedAudioFileException ex) { format = getFormatByName(_name); format = AudioSystem.getAudioFileFormat( _isdata == DYNAMIC_STREAM ? getStreamData(): _isdata) .getType().getExtension(); } catch (UnsupportedAudioFileException ex) { format = getFormatByName(_name);
if (!flacTypes[0].equals(fileType)) { throw new IllegalArgumentException("File type " + fileType + " not supported.");
final Type type = TYPE_MAP.get(dataformat); if (type != null) return type; return new Type(encoding.toString().toUpperCase(), encoding.toString()); if (lastDot != -1) { final String extension = url.substring(lastDot + 1).toLowerCase(); if (AAC.getExtension().equals(extension)) { fileType = AAC; } else if (PAAC.getExtension().equals(extension)) { fileType = PAAC; } else if (MPEG4VIDEO.getExtension().equals(extension)) { fileType = MPEG4VIDEO; } else if (MP3.getExtension().equals(extension)) { fileType = MP3; } else if (Type.WAVE.getExtension().equals(extension)) { fileType = Type.WAVE; } else if (Type.AIFF.getExtension().equals(extension)) { fileType = Type.AIFF; } else if (Type.AIFC.getExtension().equals(extension)) { fileType = Type.AIFC; } else if (MP4.getExtension().equals(extension)) { fileType = MP4; } else { fileType = new Type(extension.toUpperCase(), extension);
if (!flacTypes[0].equals(fileType)) { throw new IllegalArgumentException("File type " + fileType + " not supported.");
/** * 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(); }
+ type.toString() + " format " + format.toString() + " and bufferSize " + bufferSize + ".\n" + "The reason is " + badarg.getMessage());
if (!flacTypes[0].equals(fileType)) { throw new IllegalArgumentException("File type " + fileType + " not supported.");
if (!flacTypes[0].equals(fileType)) { throw new IllegalArgumentException("File type " + fileType + " not supported.");
private static Type getAudioFileFormatType(final String url) throws UnsupportedAudioFileException { final Type fileType; final int lastDot = url.lastIndexOf('.'); if (lastDot != -1) { final String extension = url.substring(lastDot + 1).toLowerCase(); if (AAC.getExtension().equals(extension)) { fileType = AAC; } else if (PAAC.getExtension().equals(extension)) { fileType = PAAC; } else if (MPEG4VIDEO.getExtension().equals(extension)) { fileType = MPEG4VIDEO; } else if (MP3.getExtension().equals(extension)) { fileType = MP3; } else if (Type.WAVE.getExtension().equals(extension)) { fileType = Type.WAVE; } else if (Type.AIFF.getExtension().equals(extension)) { fileType = Type.AIFF; } else if (Type.AIFC.getExtension().equals(extension)) { fileType = Type.AIFC; } else if (MP4.getExtension().equals(extension)) { fileType = MP4; } else { fileType = new Type(extension.toUpperCase(), extension); } } else { throw new UnsupportedAudioFileException("Unknown target audio url type: " + url); } return fileType; }
/** * Return an audio file format type for the given string. In addition to the built-in types, this can deal with MP3 supported * by tritonus. * * @param name * name * @return the audio file format type if it is known, or null. */ public static AudioFileFormat.Type getAudioFileFormatType(String name) { AudioFileFormat.Type at; if (name.equals("MP3")) { // Supported by tritonus plugin at = new AudioFileFormat.Type("MP3", "mp3"); } else if (name.equals("Vorbis")) { // supported by tritonus plugin at = new AudioFileFormat.Type("Vorbis", "ogg"); } else { try { at = (AudioFileFormat.Type) AudioFileFormat.Type.class.getField(name).get(null); } catch (Exception e) { return null; } } return at; }