From 52537effebb129f80d9075a1eae3ae83748f30dc Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 18 Aug 2011 17:32:49 +0000 Subject: remove Glib::ustring from libardour git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@10004 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/audio_unit.h | 4 +- libs/ardour/ardour/audiofilesource.h | 48 ++++++++++---------- libs/ardour/ardour/audiosource.h | 20 ++++----- libs/ardour/ardour/configuration_vars.h | 2 +- libs/ardour/ardour/plugin.h | 4 +- libs/ardour/ardour/session.h | 6 +-- libs/ardour/ardour/sndfilesource.h | 6 +-- libs/ardour/ardour/utils.h | 10 ++--- libs/ardour/audio_unit.cc | 20 ++++----- libs/ardour/audiofilesource.cc | 80 ++++++++++++++++----------------- libs/ardour/audiosource.cc | 12 ++--- libs/ardour/import.cc | 29 ++++++++---- libs/ardour/plugin_manager.cc | 4 +- libs/ardour/recent_sessions.cc | 4 +- libs/ardour/session.cc | 10 ++--- libs/ardour/session_state.cc | 6 +-- libs/ardour/sndfilesource.cc | 10 ++--- libs/ardour/utils.cc | 30 ++++++------- libs/ardour/vst_plugin.cc | 2 +- 19 files changed, 160 insertions(+), 147 deletions(-) diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h index cc1604f725..8d608fd074 100644 --- a/libs/ardour/ardour/audio_unit.h +++ b/libs/ardour/ardour/audio_unit.h @@ -225,7 +225,7 @@ class AUPluginInfo : public PluginInfo { AUPluginCachedInfo cache; static PluginInfoList discover (); - static void get_names (CAComponentDescription&, std::string& name, Glib::ustring& maker); + static void get_names (CAComponentDescription&, std::string& name, std::string& maker); static std::string stringify_descriptor (const CAComponentDescription&); static int load_cached_info (); @@ -238,7 +238,7 @@ class AUPluginInfo : public PluginInfo { static void discover_fx (PluginInfoList&); static void discover_generators (PluginInfoList&); static void discover_by_description (PluginInfoList&, CAComponentDescription&); - static Glib::ustring au_cache_path (); + static std::string au_cache_path (); typedef std::map CachedInfoMap; static CachedInfoMap cached_info; diff --git a/libs/ardour/ardour/audiofilesource.h b/libs/ardour/ardour/audiofilesource.h index b91ce79079..6231c8f8b3 100644 --- a/libs/ardour/ardour/audiofilesource.h +++ b/libs/ardour/ardour/audiofilesource.h @@ -56,19 +56,19 @@ class AudioFileSource : public AudioSource { virtual ~AudioFileSource (); - int set_name (Glib::ustring newname, bool destructive); + int set_name (std::string newname, bool destructive); - Glib::ustring path() const { return _path; } - Glib::ustring peak_path (Glib::ustring audio_path); - Glib::ustring find_broken_peakfile (Glib::ustring missing_peak_path, Glib::ustring audio_path); + std::string path() const { return _path; } + std::string peak_path (std::string audio_path); + std::string find_broken_peakfile (std::string missing_peak_path, std::string audio_path); uint16_t channel() const { return _channel; } - static void set_peak_dir (Glib::ustring dir) { peak_dir = dir; } + static void set_peak_dir (std::string dir) { peak_dir = dir; } - static bool get_soundfile_info (Glib::ustring path, SoundFileInfo& _info, std::string& error); + static bool get_soundfile_info (std::string path, SoundFileInfo& _info, std::string& error); - static bool safe_file_extension (Glib::ustring path); + static bool safe_file_extension (std::string path); void set_allow_remove_if_empty (bool yn); void mark_for_remove(); @@ -86,19 +86,19 @@ class AudioFileSource : public AudioSource { virtual int update_header (nframes_t when, struct tm&, time_t) = 0; virtual int flush_header () = 0; - int move_to_trash (const Glib::ustring& trash_dir_name); + int move_to_trash (const std::string& trash_dir_name); - static bool is_empty (Session&, Glib::ustring path); + static bool is_empty (Session&, std::string path); void mark_streaming_write_completed (); - void mark_take (Glib::ustring); - Glib::ustring take_id() const { return _take_id; } + void mark_take (std::string); + std::string take_id() const { return _take_id; } bool is_embedded() const { return _is_embedded; } static void set_bwf_serial_number (int); - static void set_search_path (Glib::ustring string); + static void set_search_path (std::string string); static void set_header_position_offset (nframes_t offset ); int setup_peakfile (); @@ -127,38 +127,38 @@ class AudioFileSource : public AudioSource { virtual void set_timeline_position (int64_t pos); - static bool find (Glib::ustring path, bool must_exist, bool embedded, bool& is_new, uint16_t& chan, - Glib::ustring& found_path, std::string& found_name); + static bool find (std::string path, bool must_exist, bool embedded, bool& is_new, uint16_t& chan, + std::string& found_path, std::string& found_name); protected: /* constructor to be called for existing external-to-session files */ - AudioFileSource (Session&, Glib::ustring path, Flag flags); + AudioFileSource (Session&, std::string path, Flag flags); /* constructor to be called for new in-session files */ - AudioFileSource (Session&, Glib::ustring path, Flag flags, + AudioFileSource (Session&, std::string path, Flag flags, SampleFormat samp_format, HeaderFormat hdr_format); /* constructor to be called for existing in-session files */ AudioFileSource (Session&, const XMLNode&, bool must_exit = true); - int init (Glib::ustring idstr, bool must_exist); + int init (std::string idstr, bool must_exist); - Glib::ustring _path; + std::string _path; Flag _flags; - Glib::ustring _take_id; + std::string _take_id; int64_t timeline_position; bool file_is_new; uint16_t _channel; bool _is_embedded; - static bool determine_embeddedness(Glib::ustring path); + static bool determine_embeddedness(std::string path); - static Glib::ustring peak_dir; - static Glib::ustring search_path; + static std::string peak_dir; + static std::string search_path; static char bwf_country_code[3]; static char bwf_organization_code[4]; @@ -174,8 +174,8 @@ class AudioFileSource : public AudioSource { static Sample* get_interleave_buffer (nframes_t size); private: - Glib::ustring old_peak_path (Glib::ustring audio_path); - Glib::ustring broken_peak_path (Glib::ustring audio_path); + std::string old_peak_path (std::string audio_path); + std::string broken_peak_path (std::string audio_path); void fix_writable_flags (); void prevent_deletion (); diff --git a/libs/ardour/ardour/audiosource.h b/libs/ardour/ardour/audiosource.h index ef455f9735..15ebf79782 100644 --- a/libs/ardour/ardour/audiosource.h +++ b/libs/ardour/ardour/audiosource.h @@ -46,7 +46,7 @@ namespace ARDOUR { class AudioSource : public Source, public boost::enable_shared_from_this { public: - AudioSource (Session&, Glib::ustring name); + AudioSource (Session&, std::string name); AudioSource (Session&, const XMLNode&); virtual ~AudioSource (); @@ -85,8 +85,8 @@ class AudioSource : public Source, public boost::enable_shared_from_this paths; + std::vector paths; bool replace_existing_source; /* result */ @@ -681,7 +681,7 @@ class Session : public PBD::StatefulDestructible boost::shared_ptr create_audio_source_for_session (ARDOUR::AudioDiskstream&, uint32_t which_channel, bool destructive); boost::shared_ptr source_by_id (const PBD::ID&); - boost::shared_ptr source_by_path_and_channel (const Glib::ustring&, uint16_t); + boost::shared_ptr source_by_path_and_channel (const std::string&, uint16_t); /* playlist management */ diff --git a/libs/ardour/ardour/sndfilesource.h b/libs/ardour/ardour/sndfilesource.h index dc83fc6ec1..878f612a14 100644 --- a/libs/ardour/ardour/sndfilesource.h +++ b/libs/ardour/ardour/sndfilesource.h @@ -30,11 +30,11 @@ class SndFileSource : public AudioFileSource { public: /* constructor to be called for existing external-to-session files */ - SndFileSource (Session&, Glib::ustring path, int chn, Flag flags); + SndFileSource (Session&, std::string path, int chn, Flag flags); /* constructor to be called for new in-session files */ - SndFileSource (Session&, Glib::ustring path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, + SndFileSource (Session&, std::string path, SampleFormat samp_format, HeaderFormat hdr_format, nframes_t rate, Flag flags = SndFileSource::default_writable_flags); /* constructor to be called for existing in-session files */ @@ -61,7 +61,7 @@ class SndFileSource : public AudioFileSource { static void setup_standard_crossfades (nframes_t sample_rate); static const AudioFileSource::Flag default_writable_flags; - static int get_soundfile_info (const Glib::ustring& path, SoundFileInfo& _info, string& error_msg); + static int get_soundfile_info (const std::string& path, SoundFileInfo& _info, string& error_msg); protected: void set_header_timeline_position (); diff --git a/libs/ardour/ardour/utils.h b/libs/ardour/ardour/utils.h index 17ca139fb1..85dfb6840c 100644 --- a/libs/ardour/ardour/utils.h +++ b/libs/ardour/ardour/utils.h @@ -37,7 +37,7 @@ bool string_is_affirmative (const std::string& str); class XMLNode; -Glib::ustring legalize_for_path (Glib::ustring); +std::string legalize_for_path (std::string); void elapsed_time_to_str (char *buf, uint32_t seconds); std::ostream& operator<< (std::ostream& o, const ARDOUR::BBT_Time& bbt); @@ -58,11 +58,11 @@ int cmp_nocase (const std::string& s, const std::string& s2); int tokenize_fullpath (std::string fullpath, std::string& path, std::string& name); -int touch_file(Glib::ustring path); +int touch_file(std::string path); -Glib::ustring path_expand (Glib::ustring); -Glib::ustring region_name_from_path (Glib::ustring path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0); -bool path_is_paired (Glib::ustring path, Glib::ustring& pair_base); +std::string path_expand (std::string); +std::string region_name_from_path (std::string path, bool strip_channels, bool add_channel_suffix = false, uint32_t total = 0, uint32_t this_one = 0); +bool path_is_paired (std::string path, std::string& pair_base); void compute_equal_power_fades (nframes_t nframes, float* in, float* out); diff --git a/libs/ardour/audio_unit.cc b/libs/ardour/audio_unit.cc index 10a856834d..02d34256cf 100644 --- a/libs/ardour/audio_unit.cc +++ b/libs/ardour/audio_unit.cc @@ -136,7 +136,7 @@ _get_transport_state_callback (void* userData, static int -save_property_list (CFPropertyListRef propertyList, Glib::ustring path) +save_property_list (CFPropertyListRef propertyList, std::string path) { CFDataRef xmlData; @@ -184,7 +184,7 @@ save_property_list (CFPropertyListRef propertyList, Glib::ustring path) static CFPropertyListRef -load_property_list (Glib::ustring path) +load_property_list (std::string path) { int fd; CFPropertyListRef propertyList = 0; @@ -359,7 +359,7 @@ AUPlugin::AUPlugin (AudioEngine& engine, Session& session, boost::shared_ptr v; - Glib::ustring user_preset_path; + vector v; + std::string user_preset_path; bool ret = true; std::string m = maker(); @@ -2041,7 +2041,7 @@ AUPluginInfo::load (Session& session) } } -Glib::ustring +std::string AUPluginInfo::au_cache_path () { return Glib::build_filename (ARDOUR::get_user_ardour_path(), "au_cache"); @@ -2304,7 +2304,7 @@ AUPluginInfo::save_cached_info () } - Glib::ustring path = au_cache_path (); + std::string path = au_cache_path (); XMLTree tree; tree.set_root (node); @@ -2318,7 +2318,7 @@ AUPluginInfo::save_cached_info () int AUPluginInfo::load_cached_info () { - Glib::ustring path = au_cache_path (); + std::string path = au_cache_path (); XMLTree tree; if (!Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { @@ -2416,7 +2416,7 @@ AUPluginInfo::load_cached_info () } void -AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, Glib::ustring& maker) +AUPluginInfo::get_names (CAComponentDescription& comp_desc, std::string& name, std::string& maker) { CFStringRef itemName = NULL; diff --git a/libs/ardour/audiofilesource.cc b/libs/ardour/audiofilesource.cc index ba5ab8a793..f5ceab560d 100644 --- a/libs/ardour/audiofilesource.cc +++ b/libs/ardour/audiofilesource.cc @@ -61,8 +61,8 @@ using namespace ARDOUR; using namespace PBD; using namespace Glib; -ustring AudioFileSource::peak_dir = ""; -ustring AudioFileSource::search_path; +string AudioFileSource::peak_dir = ""; +string AudioFileSource::search_path; sigc::signal AudioFileSource::HeaderPositionOffsetChanged; uint64_t AudioFileSource::header_position_offset = 0; @@ -85,7 +85,7 @@ struct SizedSampleBuffer { Glib::StaticPrivate thread_interleave_buffer = GLIBMM_STATIC_PRIVATE_INIT; -AudioFileSource::AudioFileSource (Session& s, ustring path, Flag flags) +AudioFileSource::AudioFileSource (Session& s, string path, Flag flags) : AudioSource (s, path), _flags (flags), _channel (0) { @@ -100,7 +100,7 @@ AudioFileSource::AudioFileSource (Session& s, ustring path, Flag flags) fix_writable_flags (); } -AudioFileSource::AudioFileSource (Session& s, ustring path, Flag flags, SampleFormat samp_format, HeaderFormat hdr_format) +AudioFileSource::AudioFileSource (Session& s, string path, Flag flags, SampleFormat samp_format, HeaderFormat hdr_format) : AudioSource (s, path), _flags (flags), _channel (0) { @@ -169,7 +169,7 @@ AudioFileSource::fix_writable_flags () } bool -AudioFileSource::determine_embeddedness (ustring path) +AudioFileSource::determine_embeddedness (string path) { return (path.find("/") == 0); } @@ -187,7 +187,7 @@ AudioFileSource::writable() const } int -AudioFileSource::init (ustring pathstr, bool must_exist) +AudioFileSource::init (string pathstr, bool must_exist) { _length = 0; timeline_position = 0; @@ -209,10 +209,10 @@ AudioFileSource::init (ustring pathstr, bool must_exist) } -ustring -AudioFileSource::peak_path (ustring audio_path) +string +AudioFileSource::peak_path (string audio_path) { - ustring base; + string base; base = PBD::basename_nosuffix (audio_path); base += '%'; @@ -221,10 +221,10 @@ AudioFileSource::peak_path (ustring audio_path) return _session.peak_path (base); } -ustring -AudioFileSource::find_broken_peakfile (ustring peak_path, ustring audio_path) +string +AudioFileSource::find_broken_peakfile (string peak_path, string audio_path) { - ustring str; + string str; /* check for the broken location in use by 2.0 for several months */ @@ -262,21 +262,21 @@ AudioFileSource::find_broken_peakfile (ustring peak_path, ustring audio_path) return peak_path; } -ustring -AudioFileSource::broken_peak_path (ustring audio_path) +string +AudioFileSource::broken_peak_path (string audio_path) { return Glib::build_filename(_session.peak_dir (), PBD::basename_nosuffix (audio_path) + ".peak"); } -ustring -AudioFileSource::old_peak_path (ustring audio_path) +string +AudioFileSource::old_peak_path (string audio_path) { /* XXX hardly bombproof! fix me */ struct stat stat_file; struct stat stat_mount; - ustring mp = mountpoint (audio_path); + string mp = mountpoint (audio_path); stat (audio_path.c_str(), &stat_file); stat (mp.c_str(), &stat_mount); @@ -288,14 +288,14 @@ AudioFileSource::old_peak_path (ustring audio_path) snprintf (buf, sizeof (buf), "%ld-%ld-%d.peak", stat_mount.st_ino, stat_file.st_ino, _channel); #endif - ustring res = peak_dir; + string res = peak_dir; res += buf; return res; } bool -AudioFileSource::get_soundfile_info (ustring path, SoundFileInfo& _info, string& error_msg) +AudioFileSource::get_soundfile_info (string path, SoundFileInfo& _info, string& error_msg) { /* try sndfile first because it gets timecode info from .wav (BWF) if it exists, which at present, ExtAudioFile from Apple seems unable to do. @@ -396,7 +396,7 @@ AudioFileSource::mark_streaming_write_completed () } void -AudioFileSource::mark_take (ustring id) +AudioFileSource::mark_take (string id) { if (writable()) { _take_id = id; @@ -404,14 +404,14 @@ AudioFileSource::mark_take (ustring id) } int -AudioFileSource::move_to_trash (const ustring& trash_dir_name) +AudioFileSource::move_to_trash (const string& trash_dir_name) { if (is_embedded()) { cerr << "tried to move an embedded region to trash" << endl; return -1; } - ustring newpath; + string newpath; if (!writable()) { return -1; @@ -440,7 +440,7 @@ AudioFileSource::move_to_trash (const ustring& trash_dir_name) char buf[PATH_MAX+1]; int version = 1; - ustring newpath_v; + string newpath_v; snprintf (buf, sizeof (buf), "%s.%d", newpath.c_str(), version); newpath_v = buf; @@ -492,11 +492,11 @@ AudioFileSource::move_to_trash (const ustring& trash_dir_name) } bool -AudioFileSource::find (ustring pathstr, bool must_exist, bool embedded, +AudioFileSource::find (string pathstr, bool must_exist, bool embedded, bool& isnew, uint16_t& chan, - ustring& path, std::string& name) + string& path, std::string& name) { - ustring::size_type pos; + string::size_type pos; bool ret = false; isnew = false; @@ -505,10 +505,10 @@ AudioFileSource::find (ustring pathstr, bool must_exist, bool embedded, /* non-absolute pathname: find pathstr in search path */ - vector dirs; + vector dirs; int cnt; - ustring fullpath; - ustring keeppath; + string fullpath; + string keeppath; if (search_path.length() == 0) { error << _("FileSource: search path not set") << endmsg; @@ -519,7 +519,7 @@ AudioFileSource::find (ustring pathstr, bool must_exist, bool embedded, cnt = 0; - for (vector::iterator i = dirs.begin(); i != dirs.end(); ++i) { + for (vector::iterator i = dirs.begin(); i != dirs.end(); ++i) { fullpath = Glib::build_filename (*i, pathstr); @@ -527,7 +527,7 @@ AudioFileSource::find (ustring pathstr, bool must_exist, bool embedded, Ardour 0.99 .. this hack tries to make things sort of work. */ - if ((pos = pathstr.find_last_of (':')) != ustring::npos) { + if ((pos = pathstr.find_last_of (':')) != string::npos) { if (Glib::file_test (fullpath, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { @@ -544,7 +544,7 @@ AudioFileSource::find (ustring pathstr, bool must_exist, bool embedded, without the :suffix exists */ - ustring shorter = pathstr.substr (0, pos); + string shorter = pathstr.substr (0, pos); fullpath = Glib::build_filename (*i, shorter); if (Glib::file_test (pathstr, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { @@ -595,9 +595,9 @@ AudioFileSource::find (ustring pathstr, bool must_exist, bool embedded, /* ugh, handle ':' situation */ - if ((pos = pathstr.find_last_of (':')) != ustring::npos) { + if ((pos = pathstr.find_last_of (':')) != string::npos) { - ustring shorter = pathstr.substr (0, pos); + string shorter = pathstr.substr (0, pos); if (Glib::file_test (shorter, Glib::FILE_TEST_EXISTS|Glib::FILE_TEST_IS_REGULAR)) { chan = atoi (pathstr.substr (pos+1)); @@ -646,7 +646,7 @@ AudioFileSource::find (ustring pathstr, bool must_exist, bool embedded, } void -AudioFileSource::set_search_path (ustring p) +AudioFileSource::set_search_path (string p) { search_path = p; } @@ -681,11 +681,11 @@ AudioFileSource::set_allow_remove_if_empty (bool yn) } int -AudioFileSource::set_name (ustring newname, bool destructive) +AudioFileSource::set_name (string newname, bool destructive) { Glib::Mutex::Lock lm (_lock); - ustring oldpath = _path; - ustring newpath = Session::change_audio_path_by_name (oldpath, _name, newname, destructive); + string oldpath = _path; + string newpath = Session::change_audio_path_by_name (oldpath, _name, newname, destructive); if (newpath.empty()) { error << string_compose (_("programming error: %1"), "cannot generate a changed audio path") << endmsg; @@ -710,7 +710,7 @@ AudioFileSource::set_name (ustring newname, bool destructive) } bool -AudioFileSource::is_empty (Session& s, ustring path) +AudioFileSource::is_empty (Session& s, string path) { SoundFileInfo info; string err; @@ -734,7 +734,7 @@ AudioFileSource::setup_peakfile () } bool -AudioFileSource::safe_file_extension(ustring file) +AudioFileSource::safe_file_extension(string file) { const char* suffixes[] = { ".aif", ".AIF", diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc index 2fc7fd18cd..bee6dd6679 100644 --- a/libs/ardour/audiosource.cc +++ b/libs/ardour/audiosource.cc @@ -47,14 +47,14 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -using Glib::ustring; +using std::string; bool AudioSource::_build_missing_peakfiles = false; bool AudioSource::_build_peakfiles = false; #define _FPP 256 -AudioSource::AudioSource (Session& s, ustring name) +AudioSource::AudioSource (Session& s, string name) : Source (s, name) { _peaks_built = false; @@ -167,11 +167,11 @@ AudioSource::touch_peakfile () } int -AudioSource::rename_peakfile (ustring newpath) +AudioSource::rename_peakfile (string newpath) { /* caller must hold _lock */ - ustring oldpath = peakpath; + string oldpath = peakpath; if (access (oldpath.c_str(), F_OK) == 0) { if (rename (oldpath.c_str(), newpath.c_str()) != 0) { @@ -186,7 +186,7 @@ AudioSource::rename_peakfile (ustring newpath) } int -AudioSource::initialize_peakfile (bool newfile, ustring audio_path) +AudioSource::initialize_peakfile (bool newfile, string audio_path) { struct stat statbuf; @@ -895,7 +895,7 @@ AudioSource::truncate_peakfile () } bool -AudioSource::file_changed (ustring path) +AudioSource::file_changed (string path) { struct stat stat_file; struct stat stat_peak; diff --git a/libs/ardour/import.cc b/libs/ardour/import.cc index 08e0c537c4..1838b85d18 100644 --- a/libs/ardour/import.cc +++ b/libs/ardour/import.cc @@ -66,6 +66,8 @@ open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQua logic the same as in SourceFactory::create() */ + cerr << "Trying to open " << path << endl; + try { boost::shared_ptr source(new SndFileImportableSource(path)); @@ -75,13 +77,19 @@ open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQua /* rewrap as a resampled source */ - return boost::shared_ptr(new ResampledImportableSource(source, samplerate, quality)); + boost::shared_ptr r(new ResampledImportableSource(source, samplerate, quality)); + cerr << "sndfile returns " << r << endl; + return r; } catch (...) { + cerr << "\topen failed\n"; + #ifdef HAVE_COREAUDIO + cerr << "trying to use coreaudio to open " << path << endl; + /* libsndfile failed, see if we can use CoreAudio to handle the IO */ CAImportableSource* src = new CAImportableSource(path); @@ -93,7 +101,9 @@ open_importable_source (const string& path, nframes_t samplerate, ARDOUR::SrcQua /* rewrap as a resampled source */ - return boost::shared_ptr(new ResampledImportableSource(source, samplerate, quality)); + boost::shared_ptr r(new ResampledImportableSource(source, samplerate, quality)); + cerr << "coreaudio returns " << r << endl; + return r; #else throw; // rethrow @@ -149,6 +159,8 @@ get_paths_for_new_sources (const bool allow_replacing, const string& import_file vector new_paths; const string basename = basename_nosuffix (import_file_path); + cerr << "Getting paths for new sources based on " << import_file_path << " => " << basename << endl; + for (uint n = 0; n < channels; ++n) { std::string filepath; @@ -156,6 +168,8 @@ get_paths_for_new_sources (const bool allow_replacing, const string& import_file filepath = Glib::build_filename (session_dir, get_non_existent_filename (allow_replacing, session_dir, basename, n, channels)); + cerr << "\t" << filepath << endl; + new_paths.push_back (filepath); } @@ -193,8 +207,8 @@ create_mono_sources_for_writing (const vector& new_paths, Session& sess, { boost::shared_ptr source; - try - { + try { + cerr << "Try to create " << *i << endl; source = SourceFactory::createWritable ( sess, i->c_str(), @@ -208,6 +222,7 @@ create_mono_sources_for_writing (const vector& new_paths, Session& sess, return false; } + cerr << "\thave new file\n"; afs = boost::dynamic_pointer_cast(source); afs->set_timeline_position(timeline_position); newfiles.push_back(afs); @@ -215,7 +230,7 @@ create_mono_sources_for_writing (const vector& new_paths, Session& sess, return true; } -static Glib::ustring +static std::string compose_status_message (const string& path, uint file_samplerate, uint session_samplerate, @@ -302,9 +317,7 @@ Session::import_audiofiles (import_status& status) status.sources.clear (); - for (vector::iterator p = status.paths.begin(); - p != status.paths.end() && !status.cancel; - ++p) + for (vector::iterator p = status.paths.begin(); p != status.paths.end() && !status.cancel; ++p) { status.count++; diff --git a/libs/ardour/plugin_manager.cc b/libs/ardour/plugin_manager.cc index 78d69d10c6..7bffb9ad96 100644 --- a/libs/ardour/plugin_manager.cc +++ b/libs/ardour/plugin_manager.cc @@ -569,7 +569,7 @@ PluginManager::get_status (const PluginInfoPtr& pi) void PluginManager::save_statuses () { - Glib::ustring path = Glib::build_filename (get_user_ardour_path (), "plugin_statuses"); + std::string path = Glib::build_filename (get_user_ardour_path (), "plugin_statuses"); ofstream ofs; ofs.open (path.c_str(), ios_base::openmode (ios::out|ios::trunc)); @@ -621,7 +621,7 @@ PluginManager::save_statuses () void PluginManager::load_statuses () { - Glib::ustring path = Glib::build_filename (get_user_ardour_path (),"plugin_statuses"); + std::string path = Glib::build_filename (get_user_ardour_path (),"plugin_statuses"); ifstream ifs (path.c_str()); diff --git a/libs/ardour/recent_sessions.cc b/libs/ardour/recent_sessions.cc index 9102a49065..997c915095 100644 --- a/libs/ardour/recent_sessions.cc +++ b/libs/ardour/recent_sessions.cc @@ -39,7 +39,7 @@ using namespace PBD; int ARDOUR::read_recent_sessions (RecentSessions& rs) { - Glib::ustring path = Glib::build_filename (get_user_ardour_path(), "recent"); + std::string path = Glib::build_filename (get_user_ardour_path(), "recent"); ifstream recent (path.c_str()); @@ -81,7 +81,7 @@ ARDOUR::read_recent_sessions (RecentSessions& rs) int ARDOUR::write_recent_sessions (RecentSessions& rs) { - Glib::ustring path = Glib::build_filename (get_user_ardour_path(), "recent"); + std::string path = Glib::build_filename (get_user_ardour_path(), "recent"); ofstream recent (path.c_str()); diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index ed28809005..e80a81e868 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -3135,7 +3135,7 @@ Session::source_by_id (const PBD::ID& id) boost::shared_ptr -Session::source_by_path_and_channel (const Glib::ustring& path, uint16_t chn) +Session::source_by_path_and_channel (const string& path, uint16_t chn) { Glib::Mutex::Lock lm (audio_source_lock); @@ -3150,10 +3150,10 @@ Session::source_by_path_and_channel (const Glib::ustring& path, uint16_t chn) return boost::shared_ptr(); } -Glib::ustring -Session::peak_path (Glib::ustring base) const +string +Session::peak_path (string base) const { - return Glib::build_filename(peak_dir (), base + ".peak"); + return Glib::build_filename (peak_dir (), base + ".peak"); } string @@ -3589,7 +3589,7 @@ Session::remove_empty_sounds () unlink ((*i)->c_str()); - Glib::ustring peakpath = peak_path (PBD::basename_nosuffix (**i)); + std::string peakpath = peak_path (PBD::basename_nosuffix (**i)); unlink (peakpath.c_str()); } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index e3e54f8c2d..a52732a8b2 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -2554,7 +2554,7 @@ Session::get_route_templates (vector& template_names) int Session::read_favorite_dirs (FavoriteDirs & favs) { - Glib::ustring path = Glib::build_filename (get_user_ardour_path(), "favorite_dirs"); + std::string path = Glib::build_filename (get_user_ardour_path(), "favorite_dirs"); ifstream fav (path.c_str()); @@ -2588,7 +2588,7 @@ Session::read_favorite_dirs (FavoriteDirs & favs) int Session::write_favorite_dirs (FavoriteDirs & favs) { - Glib::ustring path = Glib::build_filename (get_user_ardour_path(), "favorite_dirs"); + std::string path = Glib::build_filename (get_user_ardour_path(), "favorite_dirs"); ofstream fav (path.c_str()); @@ -2653,7 +2653,7 @@ Session::find_all_sources (string path, set& result) bool is_new; uint16_t chan; - Glib::ustring path; + std::string path; std::string name; if (AudioFileSource::find (prop->value(), true, false, is_new, chan, path, name)) { diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc index 2fa16d920d..303251e06a 100644 --- a/libs/ardour/sndfilesource.cc +++ b/libs/ardour/sndfilesource.cc @@ -39,7 +39,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -using Glib::ustring; +using std::string; gain_t* SndFileSource::out_coefficient = 0; gain_t* SndFileSource::in_coefficient = 0; @@ -74,7 +74,7 @@ SndFileSource::SndFileSource (Session& s, const XMLNode& node) } } -SndFileSource::SndFileSource (Session& s, ustring path, int chn, Flag flags) +SndFileSource::SndFileSource (Session& s, string path, int chn, Flag flags) /* files created this way are never writable or removable */ : AudioFileSource (s, path, Flag (flags & ~(Writable|Removable|RemovableIfEmpty|RemoveAtDestroy))) { @@ -87,7 +87,7 @@ SndFileSource::SndFileSource (Session& s, ustring path, int chn, Flag flags) } } -SndFileSource::SndFileSource (Session& s, ustring path, SampleFormat sfmt, HeaderFormat hf, nframes_t rate, Flag flags) +SndFileSource::SndFileSource (Session& s, string path, SampleFormat sfmt, HeaderFormat hf, nframes_t rate, Flag flags) : AudioFileSource (s, path, flags, sfmt, hf) { int fmt = 0; @@ -193,7 +193,7 @@ SndFileSource::SndFileSource (Session& s, ustring path, SampleFormat sfmt, Heade void SndFileSource::init () { - ustring file; + string file; // lets try to keep the object initalizations here at the top xfade_buf = 0; @@ -859,7 +859,7 @@ SndFileSource::set_timeline_position (int64_t pos) } int -SndFileSource::get_soundfile_info (const ustring& path, SoundFileInfo& info, string& error_msg) +SndFileSource::get_soundfile_info (const string& path, SoundFileInfo& info, string& error_msg) { SNDFILE *sf; SF_INFO sf_info; diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc index 3e4bfe57b6..8d8f48323b 100644 --- a/libs/ardour/utils.cc +++ b/libs/ardour/utils.cc @@ -44,7 +44,7 @@ using namespace ARDOUR; using namespace std; using namespace PBD; -using Glib::ustring; +using std::string; void elapsed_time_to_str (char *buf, uint32_t seconds) @@ -88,12 +88,12 @@ elapsed_time_to_str (char *buf, uint32_t seconds) } } -ustring -legalize_for_path (ustring str) +string +legalize_for_path (string str) { - ustring::size_type pos; - ustring legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: "; - ustring legal; + string::size_type pos; + string legal_chars = "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_+=: "; + string legal; legal = str; pos = 0; @@ -217,7 +217,7 @@ tokenize_fullpath (string fullpath, string& path, string& name) } int -touch_file (ustring path) +touch_file (string path) { int fd = open (path.c_str(), O_RDWR|O_CREAT, 0660); if (fd >= 0) { @@ -227,8 +227,8 @@ touch_file (ustring path) return 1; } -ustring -region_name_from_path (ustring path, bool strip_channels, bool add_channel_suffix, uint32_t total, uint32_t this_one) +string +region_name_from_path (string path, bool strip_channels, bool add_channel_suffix, uint32_t total, uint32_t this_one) { path = PBD::basename_nosuffix (path); @@ -236,7 +236,7 @@ region_name_from_path (ustring path, bool strip_channels, bool add_channel_suffi /* remove any "?R", "?L" or "?[a-z]" channel identifier */ - ustring::size_type len = path.length(); + string::size_type len = path.length(); if (len > 3 && (path[len-2] == '%' || path[len-2] == '?' || path[len-2] == '.') && (path[len-1] == 'R' || path[len-1] == 'L' || (islower (path[len-1])))) { @@ -260,9 +260,9 @@ region_name_from_path (ustring path, bool strip_channels, bool add_channel_suffi } bool -path_is_paired (ustring path, ustring& pair_base) +path_is_paired (string path, string& pair_base) { - ustring::size_type pos; + string::size_type pos; /* remove filename suffixes etc. */ @@ -270,7 +270,7 @@ path_is_paired (ustring path, ustring& pair_base) path = path.substr (0, pos); } - ustring::size_type len = path.length(); + string::size_type len = path.length(); /* look for possible channel identifier: "?R", "%R", ".L" etc. */ @@ -285,8 +285,8 @@ path_is_paired (ustring path, ustring& pair_base) return false; } -ustring -path_expand (ustring path) +string +path_expand (string path) { #ifdef HAVE_WORDEXP /* Handle tilde and environment variable expansion in session path */ diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc index 6d4a2daea8..a1db7df303 100644 --- a/libs/ardour/vst_plugin.cc +++ b/libs/ardour/vst_plugin.cc @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include -- cgit v1.2.3