#include <glibmm/fileutils.h>
#include <glibmm/miscutils.h>
+#include "pbd/file_utils.h"
#include "pbd/scoped_file_descriptor.h"
#include "pbd/xml++.h"
#include "ardour/audiosource.h"
#include "ardour/rc_configuration.h"
#include "ardour/runtime_functions.h"
+#include "ardour/session.h"
#include "i18n.h"
_peakpath = construct_peak_filepath (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);
+ 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)) {
if (errno != ENOENT) {
/* it exists in the peaks dir, but there is some kind of error */
lp.release(); // allow butler to refill buffers
+ if (_session.deletion_in_progress()) {
+ cerr << "peak file creation interrupted: " << _name << endmsg;
+ done_with_peakfile_writes (false);
+ goto out;
+ }
+
if (compute_and_write_peaks (buf.get(), current_frame, frames_read, true, false, _FPP)) {
break;
}