more work on the suprisingly ongoing filename/path/origin issue
authorPaul Davis <paul@linuxaudiosystems.com>
Sun, 31 Mar 2013 13:35:06 +0000 (09:35 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Sun, 31 Mar 2013 13:35:06 +0000 (09:35 -0400)
libs/ardour/ardour/audiosource.h
libs/ardour/audio_playlist_source.cc
libs/ardour/audiofilesource.cc
libs/ardour/audiosource.cc
libs/ardour/file_source.cc

index 344541d945a1cefb61c4a606fd7df8b52d628737..d5c85a6bf8068cce50a312cd6ad0ef2e4fc5e07f 100644 (file)
@@ -128,7 +128,7 @@ class AudioSource : virtual public Source,
        std::string         peakpath;
        std::string        _captured_for;
 
-       int initialize_peakfile (bool newfile, std::string path);
+       int initialize_peakfile (std::string path);
        int build_peaks_from_scratch ();
        int compute_and_write_peaks (Sample* buf, framecnt_t first_frame, framecnt_t cnt,
        bool force, bool intermediate_peaks_ready_signal);
index f82cb7de00492b45163e19786ae19f39afa63653..5e8dc09d452a1c5a02d58e837438465fa0555111 100644 (file)
@@ -213,7 +213,7 @@ int
 AudioPlaylistSource::setup_peakfile ()
 {
        _peak_path = Glib::build_filename (_session.session_directory().peak_path(), name() + ARDOUR::peakfile_suffix);
-       return initialize_peakfile (false, string());
+       return initialize_peakfile (string());
 }
 
 string
index e7d69d2258d631647361a2faac3f9be0514c7274..13b03f8f4828fdaa3998ef7b09b7c4938d89eb00 100644 (file)
@@ -320,7 +320,7 @@ int
 AudioFileSource::setup_peakfile ()
 {
        if (!(_flags & NoPeakFile)) {
-               return initialize_peakfile (_origin.empty(), _path);
+               return initialize_peakfile (_path);
        } else {
                return 0;
        }
index 5b60c577ee5e8d47184db349acbc81142ca3e02e..74dd52d5044ba3fa1e85d438a2a7608337c61c99 100644 (file)
@@ -207,7 +207,7 @@ AudioSource::rename_peakfile (string newpath)
 }
 
 int
-AudioSource::initialize_peakfile (bool newfile, string audio_path)
+AudioSource::initialize_peakfile (string audio_path)
 {
        struct stat statbuf;
 
@@ -215,7 +215,7 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
 
        /* if the peak file should be there, but isn't .... */
 
-       if (!newfile && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
+       if (!empty() && !Glib::file_test (peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
                peakpath = find_broken_peakfile (peakpath, audio_path);
        }
 
@@ -269,7 +269,7 @@ AudioSource::initialize_peakfile (bool newfile, string audio_path)
                }
        }
 
-       if (!newfile && !_peaks_built && _build_missing_peakfiles && _build_peakfiles) {
+       if (!empty() && !_peaks_built && _build_missing_peakfiles && _build_peakfiles) {
                build_peaks_from_scratch ();
        }
 
index e3a442b0de79fa9fda9a86131a0b7400c5232c1f..0aa0a4ade82bfc78841e3181433ea27de5c34768 100644 (file)
@@ -111,28 +111,20 @@ FileSource::init (const string& pathstr, bool must_exist)
 {
        _timeline_position = 0;
 
-       if (!_file_is_new) {
-
-               if (Stateful::loading_state_version < 3000) {
-                       if (!find_2X (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) {
-                               throw MissingSource (pathstr, _type);
-                       }
-               } else {
-                       string look_for;
-                       
-                       if (!_origin.empty()) {
-                               look_for = _origin;
-                       } else {
-                               look_for = pathstr;
-                       }
-                       
-                       if (!find (_session, _type, look_for, must_exist, _file_is_new, _channel, _path)) {
-                               throw MissingSource (pathstr, _type);
-                       }
+       cerr << "FileSource looking for " << pathstr << endl;
+       
+       if (Stateful::loading_state_version < 3000) {
+               if (!find_2X (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) {
+                       throw MissingSource (pathstr, _type);
+               }
+       } else {
+               if (!find (_session, _type, pathstr, must_exist, _file_is_new, _channel, _path)) {
+                       throw MissingSource (pathstr, _type);
                }
        }
 
        set_within_session_from_path (_path);
+
         _name = Glib::path_get_basename (_path);
 
        if (must_exist) {