diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-10 10:07:04 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2014-06-10 10:07:04 -0400 |
commit | 107e0d6d02333cd9947ddba4120af95175e5643e (patch) | |
tree | 832ae77039f98979ab9059494523e1b06e318a67 /libs/ardour/source_factory.cc | |
parent | 3f38a602cc4a6170dda7c19f7dd14f11717d5c9b (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.cc | 33 |
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) { |