X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=blobdiff_plain;f=libs%2Fardour%2Futils.cc;h=8e57cdeac305af0224101dab6b2612b80453d458;hp=9c0aea885bba3d9213e2a1c8cdfc21731cd8e5bb;hb=c8c6bca6587450ff64303dbc994a4cd28d6ce7aa;hpb=ad017365f7a73f8ba57f667cc1aa36478b48c50e diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 9c0aea885b..8e57cdeac3 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #ifndef COMPILER_MSVC @@ -42,6 +41,8 @@ #include #include +#include "pbd/gstdio_compat.h" + #include #include @@ -56,7 +57,7 @@ #include "ardour/utils.h" #include "ardour/rc_configuration.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; using namespace std; @@ -132,13 +133,13 @@ ARDOUR::legalize_for_uri (const string& str) * version. */ -string +string ARDOUR::legalize_for_path_2X (const string& str) { string::size_type pos; string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: "; Glib::ustring legal; - + /* this is the one place in Ardour where we need to iterate across * potential multibyte characters, and thus we need Glib::ustring */ @@ -296,17 +297,6 @@ ARDOUR::cmp_nocase_utf8 (const string& s1, const string& s2) return retval; } -int -ARDOUR::touch_file (string path) -{ - int fd = open (path.c_str(), O_RDWR|O_CREAT, 0660); - if (fd >= 0) { - close (fd); - return 0; - } - return 1; -} - string ARDOUR::region_name_from_path (string path, bool strip_channels, bool add_channel_suffix, uint32_t total, uint32_t this_one) { @@ -429,7 +419,7 @@ ARDOUR::string_to_edit_mode (string str) return Lock; } fatal << string_compose (_("programming error: unknown edit mode string \"%1\""), str) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return Slide; } @@ -467,8 +457,12 @@ ARDOUR::string_to_sync_source (string str) return Engine; } + if (str == _("LTC")) { + return LTC; + } + fatal << string_compose (_("programming error: unknown sync source string \"%1\""), str) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return Engine; } @@ -521,11 +515,8 @@ ARDOUR::meter_falloff_to_float (MeterFalloff falloff) case MeterFalloffModerate: return METER_FALLOFF_MODERATE; case MeterFalloffFast: - return METER_FALLOFF_FAST; - case MeterFalloffFaster: - return METER_FALLOFF_FASTER; + case MeterFalloffFaster: // backwards compat enum MeterFalloff case MeterFalloffFastest: - return METER_FALLOFF_FASTEST; default: return METER_FALLOFF_FAST; } @@ -552,14 +543,8 @@ ARDOUR::meter_falloff_from_float (float val) else if (val <= METER_FALLOFF_MEDIUM) { return MeterFalloffMedium; } - else if (val <= METER_FALLOFF_FAST) { - return MeterFalloffFast; - } - else if (val <= METER_FALLOFF_FASTER) { - return MeterFalloffFaster; - } else { - return MeterFalloffFastest; + return MeterFalloffFast; } } @@ -577,7 +562,7 @@ ARDOUR::string_to_auto_state (std::string str) } fatal << string_compose (_("programming error: %1 %2"), "illegal AutoState string: ", str) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return Touch; } @@ -601,7 +586,7 @@ ARDOUR::auto_state_to_string (AutoState as) } fatal << string_compose (_("programming error: %1 %2"), "illegal AutoState type: ", as) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return ""; } @@ -615,7 +600,7 @@ ARDOUR::string_to_auto_style (std::string str) } fatal << string_compose (_("programming error: %1 %2"), "illegal AutoStyle string: ", str) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return Trim; } @@ -634,7 +619,7 @@ ARDOUR::auto_style_to_string (AutoStyle as) } fatal << string_compose (_("programming error: %1 %2"), "illegal AutoStyle type: ", as) << endmsg; - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return ""; } @@ -665,22 +650,24 @@ ARDOUR::native_header_format_extension (HeaderFormat hf, const DataType& type) case iXML: return ".ixml"; case RF64: + case RF64_WAV: + case MBWF: return ".rf64"; } fatal << string_compose (_("programming error: unknown native header format: %1"), hf); - /*NOTREACHED*/ + abort(); /*NOTREACHED*/ return ".wav"; } bool ARDOUR::matching_unsuffixed_filename_exists_in (const string& dir, const string& path) { - string bws = basename_nosuffix (path); + string bws = basename_nosuffix (path); struct dirent* dentry; - struct stat statbuf; + GStatBuf statbuf; DIR* dead; - bool ret = false; + bool ret = false; if ((dead = ::opendir (dir.c_str())) == 0) { error << string_compose (_("cannot open directory %1 (%2)"), dir, strerror (errno)) << endl; @@ -698,7 +685,7 @@ ARDOUR::matching_unsuffixed_filename_exists_in (const string& dir, const string& string fullpath = Glib::build_filename (dir, dentry->d_name); - if (::stat (fullpath.c_str(), &statbuf)) { + if (g_stat (fullpath.c_str(), &statbuf)) { continue; } @@ -767,3 +754,4 @@ ARDOUR::slider_position_to_gain_with_max (double g, double max_gain) extern "C" { void c_stacktrace() { stacktrace (cerr); } } +