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 ()); }