Completed playlist copy constructor. Also fixed issue with layering in
authorSampo Savolainen <v2@iki.fi>
Thu, 16 Mar 2006 21:49:44 +0000 (21:49 +0000)
committerSampo Savolainen <v2@iki.fi>
Thu, 16 Mar 2006 21:49:44 +0000 (21:49 +0000)
Playlist::set_state().

git-svn-id: svn://localhost/trunk/ardour2@401 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/audio_playlist.cc
libs/ardour/playlist.cc

index 72316e30e375bf4b083756e67f9025e02c304676..0744f9c36ab890091a61f575bae7eae8eb7ea288 100644 (file)
@@ -95,7 +95,6 @@ AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, string name, bool hidd
                                                AudioRegion *out = dynamic_cast<AudioRegion*>( (*out_n) );
                                                Crossfade *new_fade = new Crossfade( *(*xfades), in, out);
                                                add_crossfade(*new_fade);
-                                               cerr << "Here we go!" << endl;
                                                break;
                                        }
                                        
@@ -106,9 +105,6 @@ AudioPlaylist::AudioPlaylist (const AudioPlaylist& other, string name, bool hidd
                        }
                }
 
-               
-               
-
                in_o++;
                in_n++;
        }
index dfe5731b858eddde49326545538f6169e4af34b6..feb0ad8bb5e7af257f7e854497c305b30b8e1292 100644 (file)
@@ -98,15 +98,32 @@ Playlist::Playlist (const Playlist& other, string namestr, bool hide)
 {
        init (hide);
 
-       _edit_mode = other._edit_mode;
-       _splicing  = other._splicing;
-       _nudging   = other._nudging;
+       RegionList tmp;
+       other.copy_regions (tmp);
        
-       other.copy_regions (regions);
+       in_set_state = true;
 
-       for (list<Region*>::iterator x = regions.begin(); x != regions.end(); ++x) {
-               (*x)->set_playlist (this);
+       for (list<Region*>::iterator x = tmp.begin(); x != tmp.end(); ++x) {
+               add_region_internal( (*x), (*x)->position() );
        }
+
+       in_set_state = false;
+
+       _splicing  = other._splicing;
+       _nudging   = other._nudging;
+       _edit_mode = other._edit_mode;
+
+       in_set_state = false;
+       in_flush = false;
+       in_partition = false;
+       subcnt = 0;
+       _read_data_count = 0;
+       _frozen = other._frozen;
+       save_on_thaw = false;
+       
+       layer_op_counter = other.layer_op_counter;
+       freeze_length = other.freeze_length;
+       
 }
 
 Playlist::Playlist (const Playlist& other, jack_nframes_t start, jack_nframes_t cnt, string str, bool hide)
@@ -413,8 +430,10 @@ Playlist::flush_notifications ()
        }
 
        if (n || pending_modified) {
-               possibly_splice ();
-               relayer ();
+               if (!in_set_state) {
+                       possibly_splice ();
+                       relayer ();
+               }
                pending_modified = false;
                Modified (); /* EMIT SIGNAL */
        }
@@ -1330,9 +1349,13 @@ Playlist::set_state (const XMLNode& node)
 
                        add_region (*region, region->position(), 1.0, false);
 
+                       // So that layer_op ordering doesn't get screwed up
+                       region->set_last_layer_op( region->layer());
+
                }                       
        }
 
+       
        /* update dependents, which was not done during add_region_internal 
           due to in_set_state being true 
        */
@@ -1340,7 +1363,7 @@ Playlist::set_state (const XMLNode& node)
        for (RegionList::iterator r = regions.begin(); r != regions.end(); ++r) {
                check_dependents (**r, false);
        }
-
+       
        in_set_state = false;
 
        return 0;