disallow placement of audio-locked tempi within a frame of any other.
[ardour.git] / libs / ardour / playlist.cc
index fcf24795db257a4b15998d0e1f47bdc678df065d..7b0f69e2ab44ff27078044446eb732e5f4c7cb3f 100644 (file)
@@ -676,7 +676,11 @@ Playlist::flush_notifications (bool from_undo)
         framepos_t pos = position;
 
         if (times == 1 && auto_partition){
-                partition(pos - 1, (pos + region->length()), true);
+               RegionList thawlist;
+               partition_internal (pos - 1, (pos + region->length()), true, thawlist);
+               for (RegionList::iterator i = thawlist.begin(); i != thawlist.end(); ++i) {
+                       (*i)->resume_property_changes ();
+               }
         }
 
         if (itimes >= 1) {
@@ -873,8 +877,10 @@ Playlist::flush_notifications (bool from_undo)
  Playlist::partition (framepos_t start, framepos_t end, bool cut)
  {
         RegionList thawlist;
-
-        partition_internal (start, end, cut, thawlist);
+        {
+         RegionWriteLock lock(this);
+         partition_internal (start, end, cut, thawlist);
+        }
 
         for (RegionList::iterator i = thawlist.begin(); i != thawlist.end(); ++i) {
                 (*i)->resume_property_changes ();
@@ -892,7 +898,6 @@ Playlist::flush_notifications (bool from_undo)
         RegionList new_regions;
 
         {
-                RegionWriteLock rlock (this);
 
                 boost::shared_ptr<Region> region;
                 boost::shared_ptr<Region> current;
@@ -1119,7 +1124,7 @@ Playlist::flush_notifications (bool from_undo)
 
        //keep track of any dead space at end (for pasting into Ripple or Splice mode)
        framepos_t wanted_length = end-start;
-       _end_space = wanted_length - get_extent().second-get_extent().first;
+       _end_space = wanted_length - _get_extent().second - _get_extent().first;
  }
 
  boost::shared_ptr<Playlist>
@@ -1185,7 +1190,10 @@ Playlist::flush_notifications (bool from_undo)
                 return boost::shared_ptr<Playlist>();
         }
 
-        partition_internal (start, start+cnt-1, true, thawlist);
+        {
+               RegionWriteLock rlock (this);
+               partition_internal (start, start+cnt-1, true, thawlist);
+        }
 
         for (RegionList::iterator i = thawlist.begin(); i != thawlist.end(); ++i) {
                 (*i)->resume_property_changes();
@@ -1327,7 +1335,7 @@ Playlist::duplicate_range (AudioRange& range, float times)
 }
 
 void
-Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float /* times */)
+Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float times)
 {
        if (ranges.empty()) {
                return;
@@ -1345,9 +1353,14 @@ Playlist::duplicate_ranges (std::list<AudioRange>& ranges, float /* times */)
 
        framecnt_t offset = max_pos - min_pos;
 
-       for (list<AudioRange>::iterator i = ranges.begin(); i != ranges.end(); ++i) {
-               boost::shared_ptr<Playlist> pl = copy ((*i).start, (*i).length(), true);
-               paste (pl, (*i).start + offset, 1.0f, 0); // times ??
+       int count = 1;
+       int itimes = (int) floor (times);
+       while (itimes--) {
+               for (list<AudioRange>::iterator i = ranges.begin (); i != ranges.end (); ++i) {
+                       boost::shared_ptr<Playlist> pl = copy ((*i).start, (*i).length (), true);
+                       paste (pl, (*i).start + (offset * count), 1.0f, 0);
+               }
+               ++count;
        }
 }