remove Ardour broken peak-file support
authorRobin Gareus <robin@gareus.org>
Tue, 8 Sep 2015 18:13:56 +0000 (20:13 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 9 Sep 2015 22:55:58 +0000 (00:55 +0200)
Ardour-2.0 put peak-files in a "broken" location for several months.
Since then Ardour renamed those files. No more. When loading ancient
sessions peak-files are now re-created (in the background).

libs/ardour/ardour/audiofilesource.h
libs/ardour/ardour/audiosource.h
libs/ardour/audiofilesource.cc
libs/ardour/audiosource.cc

index da4f9aaea5e520e1d2d086f2aaf45eb24fc8ce72..10c47d86586b2d9ccd4ceac59244bb8db6bc27f9 100644 (file)
@@ -40,8 +40,6 @@ public:
        virtual ~AudioFileSource ();
 
        std::string construct_peak_filepath (const std::string& audio_filepath) const;
-       std::string find_broken_peakfile (const std::string& missing_peak_path,
-                                         const std::string& audio_path);
 
        static void set_peak_dir (const std::string& dir) { peak_dir = dir; }
 
@@ -117,10 +115,6 @@ protected:
 
        /** Kept up to date with the position of the session location start */
        static framecnt_t header_position_offset;
-
-  private:
-       std::string old_peak_path (const std::string& audio_path);
-       std::string broken_peak_path (const std::string& audio_path);
 };
 
 } // namespace ARDOUR
index 40ff27ceb54607aa0db997ffbc5ac772dc131607..0c66cdf0e91a058b9c9cb5a8ca38ade36055191e 100644 (file)
@@ -137,8 +137,6 @@ class LIBARDOUR_API AudioSource : virtual public Source,
        virtual framecnt_t read_unlocked (Sample *dst, framepos_t start, framecnt_t cnt) const = 0;
        virtual framecnt_t write_unlocked (Sample *dst, framecnt_t cnt) = 0;
        virtual std::string construct_peak_filepath(const std::string& audio_filepath) const = 0;
-       virtual std::string find_broken_peakfile (const std::string& /* missing_peak_path */,
-                                                 const std::string& audio_path) { return construct_peak_filepath (audio_path); }
 
        virtual int read_peaks_with_fpp (PeakData *peaks,
                                         framecnt_t npeaks, framepos_t start, framecnt_t cnt,
index 633292b157f9c5f7cab82962d520869cf5ec7aa1..45ec162f094ec6fcb8dac21af8497b67d77b7198 100644 (file)
@@ -169,83 +169,6 @@ AudioFileSource::construct_peak_filepath (const string& audio_path) const
        return _session.construct_peak_filepath (audio_path);
 }
 
-string
-AudioFileSource::find_broken_peakfile (const string& peak_path, const string& audio_path)
-{
-       string str;
-
-       /* check for the broken location in use by 2.0 for several months */
-
-       str = broken_peak_path (audio_path);
-
-       if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) {
-
-               if (!within_session()) {
-
-                       /* it would be nice to rename it but the nature of
-                          the bug means that we can't reliably use it.
-                       */
-
-                       return str;
-
-               } else {
-                       /* all native files are mono, so we can just rename
-                          it.
-                       */
-                       ::rename (str.c_str(), peak_path.c_str());
-               }
-
-       } else {
-               /* Nasty band-aid for older sessions that were created before we
-                  used libsndfile for all audio files.
-               */
-#ifndef PLATFORM_WINDOWS // there's no old_peak_path() for windows
-               str = old_peak_path (audio_path);
-               if (Glib::file_test (str, Glib::FILE_TEST_EXISTS)) {
-                       return str;
-               }
-#endif
-       }
-
-       return peak_path;
-}
-
-string
-AudioFileSource::broken_peak_path (const string& audio_path)
-{
-       return _session.construct_peak_filepath (basename_nosuffix (audio_path));
-}
-
-string
-AudioFileSource::old_peak_path (const string& audio_path)
-{
-       /* XXX hardly bombproof! fix me */
-
-       struct stat stat_file;
-       struct stat stat_mount;
-
-       string mp = mountpoint (audio_path);
-
-       stat (audio_path.c_str(), &stat_file);
-       stat (mp.c_str(), &stat_mount);
-
-       char buf[32];
-#ifdef __APPLE__
-       snprintf (buf, sizeof (buf), "%llu-%llu-%d.peak",
-                       (unsigned long long)stat_mount.st_ino,
-                       (unsigned long long)stat_file.st_ino,
-                       _channel);
-#else
-       snprintf (buf, sizeof (buf), "%" PRId64 "-%" PRId64 "-%d.peak", (int64_t) stat_mount.st_ino, (int64_t) stat_file.st_ino, _channel);
-#endif
-
-       string res = peak_dir;
-       res += buf;
-       res += peakfile_suffix;
-
-       return res;
-}
-
 bool
 AudioFileSource::get_soundfile_info (const string& path, SoundFileInfo& _info, string& error_msg)
 {
index 9aea6f1e0e5e51f5639cb948a343c2664f0e62a1..62a632e435096426ab603dd1bdd342b5187ec53f 100644 (file)
@@ -244,12 +244,6 @@ AudioSource::initialize_peakfile (const string& audio_path)
 
        DEBUG_TRACE(DEBUG::Peaks, string_compose ("Initialize Peakfile %1 for Audio file %2\n", _peakpath, audio_path));
 
-       /* if the peak file should be there, but isn't .... */
-
-       if (!empty() && !Glib::file_test (_peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
-               _peakpath = find_broken_peakfile (_peakpath, audio_path);
-       }
-
        if (g_stat (_peakpath.c_str(), &statbuf)) {
                if (errno != ENOENT) {
                        /* it exists in the peaks dir, but there is some kind of error */