diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-29 16:03:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2008-10-29 16:03:00 +0000 |
commit | 53c2e47225f67b52d1c15df4814badaef50bcc3e (patch) | |
tree | 816faa1fde353cf579f23c479bffc8033e7cf8a7 /gtk2_ardour/export_dialog.cc | |
parent | deeef0a263d24b5ddbe38a601f89ec99a8f19823 (diff) |
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
Diffstat (limited to 'gtk2_ardour/export_dialog.cc')
-rw-r--r-- | gtk2_ardour/export_dialog.cc | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index 5d46b06a07..e7c297e6ee 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -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 ()); } |