refactor MIDISceneChange color property addition by moving it into SceneChange to...
[ardour.git] / libs / ardour / source_factory.cc
index 0729f21592040c615edc9bf9154247cc59404f6c..6d2bb80b30be8859716bb09fea2a3d17b6e27c07 100644 (file)
@@ -272,7 +272,7 @@ SourceFactory::createExternal (DataType type, Session& s, const string& path,
 
        } else if (type == DataType::MIDI) {
 
-               boost::shared_ptr<SMFSource> src (new SMFSource (s, path, SMFSource::Flag(0)));
+               boost::shared_ptr<SMFSource> src (new SMFSource (s, path));
                src->load_model (true, true);
 #ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
                // boost_debug_shared_ptr_mark_interesting (src, "Source");
@@ -341,6 +341,39 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
        return boost::shared_ptr<Source> ();
 }
 
+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)