summaryrefslogtreecommitdiff
path: root/libs/ardour/audiosource.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-07-17 11:52:45 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-07-17 11:52:58 -0400
commit8587fef16afd4b14e871ed22ea23492f14b8af85 (patch)
treea741c0d0e0706ab65bc71d444bcf7522f57c361f /libs/ardour/audiosource.cc
parenta78cb6b34138dddc480a6531aa9bf3d218da403f (diff)
do not carry out a size check on peakfiles for files still being recorded.
The size check (and possible rebuild) causes a crash with MSVC. It would be nice to know more about why.
Diffstat (limited to 'libs/ardour/audiosource.cc')
-rw-r--r--libs/ardour/audiosource.cc38
1 files changed, 24 insertions, 14 deletions
diff --git a/libs/ardour/audiosource.cc b/libs/ardour/audiosource.cc
index 025652aa3b..9f52e847a0 100644
--- a/libs/ardour/audiosource.cc
+++ b/libs/ardour/audiosource.cc
@@ -363,22 +363,32 @@ AudioSource::read_peaks_with_fpp (PeakData *peaks, framecnt_t npeaks, framepos_t
return -1;
}
- /* check actual size of the peakfile is at least large enough for all
- * the data in the audio file. if it is too short, assume that a crash
- * or other error truncated it, and rebuild it from scratch.
- */
+ if (!_captured_for.empty()) {
- const off_t expected_file_size = (_length / (double) samples_per_file_peak) * sizeof (PeakData);
-
- if (statbuf.st_size < expected_file_size) {
- warning << string_compose (_("peak file %1 is truncated from %2 to %3"), peakpath, expected_file_size, statbuf.st_size) << endmsg;
- const_cast<AudioSource*>(this)->build_peaks_from_scratch ();
- if (g_stat (peakpath.c_str(), &statbuf) != 0) {
- error << string_compose (_("Cannot open peakfile @ %1 for size check (%2) after rebuild"), peakpath, strerror (errno)) << endmsg;
- }
+ /* _captured_for is only set after a capture pass is
+ * complete. so we know that capturing is finished for this
+ * file, and now we can check actual size of the peakfile is at
+ * least large enough for all the data in the audio file. if it
+ * is too short, assume that a crash or other error truncated
+ * it, and rebuild it from scratch.
+ *
+ * XXX this may not work for destructive recording, but we
+ * might decided to get rid of that anyway.
+ *
+ */
+
+ const off_t expected_file_size = (_length / (double) samples_per_file_peak) * sizeof (PeakData);
+
if (statbuf.st_size < expected_file_size) {
- fatal << "peak file is still truncated after rebuild" << endmsg;
- /*NOTREACHED*/
+ warning << string_compose (_("peak file %1 is truncated from %2 to %3"), peakpath, expected_file_size, statbuf.st_size) << endmsg;
+ const_cast<AudioSource*>(this)->build_peaks_from_scratch ();
+ if (g_stat (peakpath.c_str(), &statbuf) != 0) {
+ error << string_compose (_("Cannot open peakfile @ %1 for size check (%2) after rebuild"), peakpath, strerror (errno)) << endmsg;
+ }
+ if (statbuf.st_size < expected_file_size) {
+ fatal << "peak file is still truncated after rebuild" << endmsg;
+ /*NOTREACHED*/
+ }
}
}