add missing .extensions to export files if not present, based on filetype selected (should probably do the opposite at some point, or at least point out the mismatch)

git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4029 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2008-10-29 16:03:00 +00:00
parent deeef0a263
commit 53c2e47225

View file

@ -947,6 +947,34 @@ ExportDialog::do_export ()
msg.run ();
return;
}
/* maybe add suffix */
int file_format = sndfile_header_format_from_string (header_format_combo.get_active_text ());
if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV) {
if (filepath.find (".wav") != filepath.length() - 4) {
filepath += ".wav";
}
} else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF) {
if (filepath.find (".aiff") != filepath.length() - 5) {
filepath += ".aiff";
}
} else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_W64) {
if (filepath.find (".w64") != filepath.length() - 5) {
filepath += ".w64";
}
} else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_FLAC) {
if (filepath.find (".flac") != filepath.length() - 5) {
filepath += ".flac";
}
} else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_CAF) {
if (filepath.find (".caf") != filepath.length() - 4) {
filepath += ".caf";
}
}
/* others ? */
if(!is_filepath_valid(filepath)){
return;
@ -1245,7 +1273,7 @@ ExportDialog::initSpec(string &filepath)
spec.format |= sndfile_header_format_from_string (header_format_combo.get_active_text ());
if (!Profile->get_sae()) {
if ((spec.format & SF_FORMAT_WAV) == 0) {
if (((spec.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WAV)) {
/* RIFF/WAV specifies endianess */
spec.format |= sndfile_endian_format_from_string (endian_format_combo.get_active_text ());
}