refactor playlist sources to allow for MIDI and upcoming work on save/restore
[ardour.git] / libs / ardour / source_factory.cc
index 891e43154978e5aab1589625b8a078f8d348033c..4d3f02b1dc68bad81516a0a40b77f624436f23bf 100644 (file)
@@ -326,16 +326,21 @@ SourceFactory::createWritable (DataType type, Session& s, const std::string& pat
 
 boost::shared_ptr<Source>
 SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<Playlist> p, const std::string& name,
-                                  uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, Source::Flag flags, 
-                                  bool announce, bool defer_peaks)
+                                  uint32_t chn, frameoffset_t start, framecnt_t len, bool copy, bool defer_peaks)
 {
        if (type == DataType::AUDIO) {
                try {
 
                        boost::shared_ptr<AudioPlaylist> ap = boost::dynamic_pointer_cast<AudioPlaylist>(p);
-
+                       
                        if (ap) {
-                               Source* src = new AudioPlaylistSource (s, name, ap, chn, start, len, copy, flags);
+                               
+                               if (copy) {
+                                       ap.reset (new AudioPlaylist (ap, start, len, name, true));
+                                       start = 0;
+                               }
+                               
+                               Source* src = new AudioPlaylistSource (s, name, ap, chn, start, len, Source::Flag (0));
                                boost::shared_ptr<Source> ret (src);
                                
                                if (setup_peakfile (ret, defer_peaks)) {
@@ -344,9 +349,7 @@ SourceFactory::createFromPlaylist (DataType type, Session& s, boost::shared_ptr<
                                
                                ret->check_for_analysis_data_on_disk ();
                                
-                               if (announce) {
-                                       SourceCreated (ret);
-                               }
+                               /* we never announce these sources */
                                
                                return ret;
                        }