View Issue Details

IDProjectCategoryView StatusLast Update
0002430ardourbugspublic2020-04-19 20:13
Reporterpeppot Assigned Tocth103  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Fixed in VersionSVN/2.0-ongoing 
Summary0002430: "Insert time" should move all objects; markers, automation et al
DescriptionTo make "Insert time" more useful, it should move all objects including automation, markers, ranges
TagsNo tags attached.

Activities

cth103

2008-12-02 01:42

administrator   ~0005416

As far as I can see, markers can already be moved (optionally). Automation should move though, and currently doesn't.

2008-12-02 03:37

 

2430-insert-time.patch (5,308 bytes)   
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 51cb8b6..6b86750 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -36,7 +36,6 @@
 #include <gtkmm2ext/window_title.h>
 #include <gtkmm2ext/popup.h>
 
-
 #include <ardour/audioengine.h>
 #include <ardour/session.h>
 #include <ardour/audioplaylist.h>
@@ -6014,26 +6013,34 @@ Editor::insert_time (nframes64_t pos, nframes64_t frames, InsertTimeOption opt,
 	begin_reversible_command (_("insert time"));
 
 	for (TrackSelection::iterator x = selection->tracks.begin(); x != selection->tracks.end(); ++x) {
+		/* regions */
 		boost::shared_ptr<Playlist> pl = (*x)->playlist();
 		
-		if (!pl) {
-			continue;
-		}
-
-		XMLNode &before = pl->get_state();
+		if (pl) {
 
-		if (opt == SplitIntersected) {
-			pl->split (pos);
+			XMLNode &before = pl->get_state();
+			
+			if (opt == SplitIntersected) {
+				pl->split (pos);
+			}
+			
+			pl->shift (pos, frames, (opt == MoveIntersected), ignore_music_glue);
+			
+			XMLNode &after = pl->get_state();
+			
+			session->add_command (new MementoCommand<Playlist> (*pl, &before, &after));
+			commit = true;
+		}
+			
+		/* automation */
+		RouteTimeAxisView* rtav = dynamic_cast<RouteTimeAxisView*> (*x);
+		if (rtav) {
+			rtav->route ()->shift (pos, frames);
+			commit = true;
 		}
-		
-		pl->shift (pos, frames, (opt == MoveIntersected), ignore_music_glue);
-
-		XMLNode &after = pl->get_state();
-
-		session->add_command (new MementoCommand<Playlist> (*pl, &before, &after));
-		commit = true;
 	}
 
+	/* markers */
 	if (markers_too) {
 		bool moved = false;
 		XMLNode& before (session->locations()->get_state());
diff --git a/libs/ardour/ardour/automation_event.h b/libs/ardour/ardour/automation_event.h
index b9c243f..02b306c 100644
--- a/libs/ardour/ardour/automation_event.h
+++ b/libs/ardour/ardour/automation_event.h
@@ -108,6 +108,7 @@ class AutomationList : public PBD::StatefulDestructible
 	void erase (iterator, iterator);
 	void move_range (iterator start, iterator end, double, double);
 	void modify (iterator, double, double);
+	void shift (nframes64_t, nframes64_t);
 
 	AutomationList* cut (double, double);
 	AutomationList* copy (double, double);
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index f80eb45..0ac50f4 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -106,6 +106,8 @@ class Route : public IO
 
 	/* end of vfunc-based API */
 
+	void shift (nframes64_t, nframes64_t);
+
 	/* override IO::set_gain() to provide group control */
 
 	void set_gain (gain_t val, void *src);
diff --git a/libs/ardour/automation_event.cc b/libs/ardour/automation_event.cc
index 3e257d2..44cba83 100644
--- a/libs/ardour/automation_event.cc
+++ b/libs/ardour/automation_event.cc
@@ -1426,3 +1426,20 @@ AutomationList::set_state (const XMLNode& node)
 	return 0;
 }
 
+void
+AutomationList::shift (nframes64_t pos, nframes64_t frames)
+{
+	{
+		Glib::Mutex::Lock lm (lock);
+
+		for (iterator i = begin (); i != end (); ++i) {
+			if ((*i)->when >= pos) {
+				(*i)->when += frames;
+			}
+		}
+
+		mark_dirty ();
+	}
+
+	maybe_signal_changed ();
+}
diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc
index da0529b..865814b 100644
--- a/libs/ardour/io.cc
+++ b/libs/ardour/io.cc
@@ -2806,3 +2806,4 @@ IO::set_active (bool yn)
 	 active_changed(); /* EMIT SIGNAL */
 }
 
+
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 41ba51b..edfcaa7 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -25,6 +25,7 @@
 #include <pbd/xml++.h>
 #include <pbd/enumwriter.h>
 #include <pbd/stacktrace.h>
+#include <pbd/memento_command.h>
 
 #include <ardour/timestamps.h>
 #include <ardour/buffer.h>
@@ -2614,3 +2615,47 @@ Route::set_pending_declick (int declick)
 	}
 
 }
+
+/** Shift automation forwards from a particular place, thereby inserting time.
+ *  Adds undo commands for any shifts that are performed.
+ *
+ * @param pos Position to start shifting from.
+ * @param frames Amount to shift forwards by.
+ */
+
+void
+Route::shift (nframes64_t pos, nframes64_t frames)
+{
+	/* gain automation */
+	XMLNode &before = _gain_automation_curve.get_state ();
+	_gain_automation_curve.shift (pos, frames);
+	XMLNode &after = _gain_automation_curve.get_state ();
+	_session.add_command (new MementoCommand<AutomationList> (_gain_automation_curve, &before, &after));
+
+	/* pan automation */
+	for (std::vector<StreamPanner*>::iterator i = _panner->begin (); i != _panner->end (); ++i) {
+		Curve & c = (*i)->automation ();
+		XMLNode &before = c.get_state ();
+		c.shift (pos, frames);
+		XMLNode &after = c.get_state ();
+		_session.add_command (new MementoCommand<AutomationList> (c, &before, &after));
+	}
+
+	/* redirect automation */
+	{
+		Glib::RWLock::ReaderLock lm (redirect_lock);
+		for (RedirectList::iterator i = _redirects.begin (); i != _redirects.end (); ++i) {
+			
+			set<uint32_t> a;
+			(*i)->what_has_automation (a);
+			
+			for (set<uint32_t>::const_iterator j = a.begin (); j != a.end (); ++j) {
+				AutomationList & al = (*i)->automation_list (*j);
+				XMLNode &before = al.get_state ();
+				al.shift (pos, frames);
+				XMLNode &after = al.get_state ();
+				_session.add_command (new MementoCommand<AutomationList> (al, &before, &after));
+			}
+		}
+	}
+}
2430-insert-time.patch (5,308 bytes)   

cth103

2008-12-02 03:38

administrator   ~0005417

The attached patch should fix the movement of automation when time is inserted. Is there anything else that I'm missing?

cth103

2008-12-05 14:34

administrator   ~0005498

This should now be fixed in 2.0-ongoing SVN.

system

2020-04-19 20:13

developer   ~0021805

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2008-10-26 20:58 peppot New Issue
2008-11-24 10:55 seablade Status new => acknowledged
2008-12-02 01:42 cth103 Note Added: 0005416
2008-12-02 03:37 cth103 File Added: 2430-insert-time.patch
2008-12-02 03:38 cth103 Note Added: 0005417
2008-12-02 03:38 cth103 Status acknowledged => feedback
2008-12-05 14:34 cth103 cost => 0.00
2008-12-05 14:34 cth103 Status feedback => resolved
2008-12-05 14:34 cth103 Fixed in Version => SVN/2.0-ongoing
2008-12-05 14:34 cth103 Resolution open => fixed
2008-12-05 14:34 cth103 Assigned To => cth103
2008-12-05 14:34 cth103 Note Added: 0005498
2010-04-24 10:28 cth103 Category bugs => bugs2
2010-04-24 10:32 cth103 Category bugs2 => bugs
2020-04-19 20:13 system Note Added: 0021805
2020-04-19 20:13 system Status resolved => closed