summaryrefslogtreecommitdiff
path: root/libs/ardour/sndfilesource.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-06-10 10:07:04 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2014-06-10 10:07:04 -0400
commit107e0d6d02333cd9947ddba4120af95175e5643e (patch)
tree832ae77039f98979ab9059494523e1b06e318a67 /libs/ardour/sndfilesource.cc
parent3f38a602cc4a6170dda7c19f7dd14f11717d5c9b (diff)
fix crash recovery: add new constructors to SndFileSource, AudioFileSource, add a new SourceFactory method and finally tweak
AudioDiskstream::use_pending_capture_data() to create both the required whole-file and the in-playlist regions
Diffstat (limited to 'libs/ardour/sndfilesource.cc')
-rw-r--r--libs/ardour/sndfilesource.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/libs/ardour/sndfilesource.cc b/libs/ardour/sndfilesource.cc
index e0851602fc..af25b3e76f 100644
--- a/libs/ardour/sndfilesource.cc
+++ b/libs/ardour/sndfilesource.cc
@@ -185,6 +185,34 @@ SndFileSource::SndFileSource (Session& s, const string& path, const string& orig
}
}
+/** Constructor to be called for recovering files being used for
+ * capture. They are in-session, they already exist, they should not
+ * be writable. They are an odd hybrid (from a constructor point of
+ * view) of the previous two constructors.
+ */
+SndFileSource::SndFileSource (Session& s, const string& path, int chn)
+ : Source (s, DataType::AUDIO, path, Flag (0))
+ /* the final boolean argument is not used, its value is irrelevant. see audiofilesource.h for explanation */
+ , AudioFileSource (s, path, Flag (0))
+ , _descriptor (0)
+ , _broadcast_info (0)
+ , _capture_start (false)
+ , _capture_end (false)
+ , file_pos (0)
+ , xfade_buf (0)
+{
+ _channel = chn;
+
+ init_sndfile ();
+
+ assert (Glib::file_test (_path, Glib::FILE_TEST_EXISTS));
+ existence_check ();
+
+ if (open()) {
+ throw failed_constructor ();
+ }
+}
+
void
SndFileSource::init_sndfile ()
{
@@ -266,6 +294,14 @@ SndFileSource::open ()
delete _broadcast_info;
_broadcast_info = 0;
_flags = Flag (_flags & ~Broadcast);
+ }
+
+ /* Set the broadcast flag if the BWF info is already there. We need
+ * this when recovering or using existing files.
+ */
+
+ if (bwf_info_exists) {
+ _flags = Flag (_flags | Broadcast);
}
if (writable()) {