summaryrefslogtreecommitdiff
path: root/libs/ardour/audiosource.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-09-10 00:48:10 +0200
committerRobin Gareus <robin@gareus.org>2015-09-10 00:55:58 +0200
commit390ea007c5b6b647e33c924b3429bf49ae83b1ca (patch)
tree774a07a6132c8c211de95e43a53484be5007ddbf /libs/ardour/audiosource.cc
parent78ff3c05a3f5c5d532162b45bdd8857bc402011e (diff)
rework peakfile handling:
- copy old peak-files to new (do not require re-calc) - keep old peak-files (for now, backwards compat) - fix cleanup-sources to remove *new* peak-file - include channel-number in hash (like it was done before) see also 624f76b TODO: add Session > Cleanup > remove/re-create peaks
Diffstat (limited to 'libs/ardour/audiosource.cc')
-rw-r--r--libs/ardour/audiosource.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index 62a632e435..c79cbbbe26 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -50,6 +50,7 @@
#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
+#include "pbd/file_utils.h"
#include "pbd/scoped_file_descriptor.h"
#include "pbd/xml++.h"
@@ -242,6 +243,16 @@ AudioSource::initialize_peakfile (const string& audio_path)
_peakpath = construct_peak_filepath (audio_path);
+ if (!empty() && !Glib::file_test (_peakpath.c_str(), Glib::FILE_TEST_EXISTS)) {
+ string oldpeak = construct_peak_filepath (audio_path, true);
+ DEBUG_TRACE(DEBUG::Peaks, string_compose ("Looking for old peak file %1 for Audio file %2\n", oldpeak, audio_path));
+ if (Glib::file_test (oldpeak.c_str(), Glib::FILE_TEST_EXISTS)) {
+ // TODO use hard-link if possible
+ DEBUG_TRACE(DEBUG::Peaks, string_compose ("Copy old peakfile %1 to %2\n", oldpeak, _peakpath));
+ PBD::copy_file (oldpeak, _peakpath);
+ }
+ }
+
DEBUG_TRACE(DEBUG::Peaks, string_compose ("Initialize Peakfile %1 for Audio file %2\n", _peakpath, audio_path));
if (g_stat (_peakpath.c_str(), &statbuf)) {