summaryrefslogtreecommitdiff
path: root/libs/ardour/source_factory.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:09:26 -0400
commitb660bc8ae92d19aedf0165815432b77a0c6170c4 (patch)
tree57b59514f21350b14219156ab087d5cee70a258f /libs/ardour/source_factory.cc
parent74bc0c84686c4a85941b98d17179d3209bf9a2a8 (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/source_factory.cc')
-rw-r--r--libs/ardour/source_factory.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/libs/ardour/source_factory.cc b/libs/ardour/source_factory.cc
index 391b205a94..6d2bb80b30 100644
--- a/libs/ardour/source_factory.cc
+++ b/libs/ardour/source_factory.cc
@@ -342,6 +342,39 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
}
boost::shared_ptr<Source>
+SourceFactory::createForRecovery (DataType type, Session& s, const std::string& path, int chn)
+{
+ /* this might throw failed_constructor(), which is OK */
+
+ if (type == DataType::AUDIO) {
+ Source* src = new SndFileSource (s, path, chn);
+
+#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
+ // boost_debug_shared_ptr_mark_interesting (src, "Source");
+#endif
+ boost::shared_ptr<Source> ret (src);
+
+ if (setup_peakfile (ret, false)) {
+ return boost::shared_ptr<Source>();
+ }
+
+ // no analysis data - this is still basically a new file (we
+ // crashed while recording.
+
+ // always announce these files
+
+ SourceCreated (ret);
+
+ return ret;
+
+ } else if (type == DataType::MIDI) {
+ error << _("Recovery attempted on a MIDI file - not implemented") << endmsg;
+ }
+
+ return boost::shared_ptr<Source> ();
+}
+
+boost::shared_ptr<Source>
SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<Playlist> p, const PBD::ID& orig, const std::string& name,
uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, bool defer_peaks)
{