revert VST debug hacks
[ardour.git] / libs / ardour / sndfile_helpers.cc
index d9e7aa563a6d23930e638fb4de3a0279a256190f..14bf361831155ca0482139f15d4eb09f04b1a3ad 100644 (file)
@@ -1,10 +1,15 @@
 #include <map>
+#include <vector>
 
+#include <pbd/convert.h>
+
+#include <sndfile.h>
 #include <ardour/sndfile_helpers.h>
 
 #include "i18n.h"
 
 using std::map;
+using namespace std;
 
 const char * const sndfile_header_formats_strings[SNDFILE_HEADER_FORMATS+1] = {
        N_("WAV"),
@@ -17,6 +22,17 @@ const char * const sndfile_header_formats_strings[SNDFILE_HEADER_FORMATS+1] = {
        0
 };
 
+const char* const sndfile_file_endings_strings[SNDFILE_HEADER_FORMATS+1] = {
+       N_(".wav"),
+       N_(".aiff"),
+       N_(".raw"),
+       N_(".paf"),
+       N_(".au"),
+       N_(".ircam"),
+       N_(".w64"),
+       0
+};
+
 int sndfile_header_formats[SNDFILE_HEADER_FORMATS] = {
        SF_FORMAT_WAV,
        SF_FORMAT_AIFF,
@@ -88,6 +104,23 @@ sndfile_endian_format_from_string (string str)
        return -1;
 }
 
+string
+sndfile_file_ending_from_string (string str)
+{
+       static vector<string> file_endings;
+
+       if (file_endings.empty()) {
+               file_endings = I18N((const char **) sndfile_file_endings_strings);
+       }
+
+       for (int n = 0; sndfile_header_formats_strings[n]; ++n) {
+               if (str == sndfile_header_formats_strings[n]) {
+                       return file_endings[n];
+               }
+       }
+       return 0;
+}
+
 int
 sndfile_data_width (int format)
 {
@@ -160,3 +193,4 @@ sndfile_minor_format(int format)
                return "-Unknown-";
        }
 }
+