make bounce range and bounce region work properly (wrong boundaries before); add...
[ardour.git] / gtk2_ardour / editor_ops.cc
index 6ae78ff1cb6bfbd5e046798e3003e04d4bf97bbb..50980e4d09298d5b4c3d154141064f475ac479b4 100644 (file)
@@ -3614,7 +3614,7 @@ Editor::freeze_route ()
 }
 
 void
-Editor::bounce_range_selection ()
+Editor::bounce_range_selection (bool replace)
 {
        if (selection->time.empty()) {
                return;
@@ -3649,7 +3649,15 @@ Editor::bounce_range_selection ()
                itt.progress = false;
 
                 XMLNode &before = playlist->get_state();
-               atv->audio_track()->bounce_range (start, cnt, itt);
+               boost::shared_ptr<Region> r = atv->audio_track()->bounce_range (start, start+cnt, itt);
+               
+               if (replace) {
+                       list<AudioRange> ranges;
+                       ranges.push_back (AudioRange (start, start+cnt, 0));
+                       playlist->cut (ranges); // discard result
+                       playlist->add_region (r, start);
+               }
+
                 XMLNode &after = playlist->get_state();
                session->add_command (new MementoCommand<Playlist> (*playlist, &before, &after));
        }