View Issue Details

IDProjectCategoryView StatusLast Update
0001158ardourbugspublic2008-11-21 00:30
Reporterslinkp Assigned Topaul  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version0.99 
Summary0001158: "Clear" removes redirects from both pre and post
Descriptionmaybe not everyone would agree, but i find it very surprising behavior that when i clear pre-fader plugins/redirects, post-fader gets cleared also.
And vice versa. My thought is that since i right-clicked on the "pre" box,
only stuff in that box should be cleared. Feel free to disagree :)
TagsNo tags attached.

Activities

2007-03-23 12:22

 

1158.patch (4,376 bytes)   
Index: gtk2_ardour/redirect_box.cc
===================================================================
--- gtk2_ardour/redirect_box.cc	(revision 139)
+++ gtk2_ardour/redirect_box.cc	(working copy)
@@ -957,21 +957,31 @@
 void
 RedirectBox::all_redirects_active (bool state)
 {
-	_route->all_redirects_active (state);
+	_route->all_redirects_active (_placement, state);
 }
 
 void
-RedirectBox::clear_redirects()
+RedirectBox::clear_redirects ()
 {
 	string prompt;
 	vector<string> choices;
 
 	if (boost::dynamic_pointer_cast<AudioTrack>(_route) != 0) {
-		prompt = _("Do you really want to remove all redirects from this track?\n"
-			   "(this cannot be undone)");
+		if (_placement == PreFader) {
+			prompt = _("Do you really want to remove all pre-fader redirects from this track?\n"
+				   "(this cannot be undone)");
+		} else {
+			prompt = _("Do you really want to remove all post-fader redirects from this track?\n"
+				   "(this cannot be undone)");
+		}
 	} else {
-		prompt = _("Do you really want to remove all redirects from this bus?\n"
-			   "(this cannot be undone)");
+		if (_placement == PreFader) {
+			prompt = _("Do you really want to remove all pre-fader redirects from this bus?\n"
+				   "(this cannot be undone)");
+		} else {
+			prompt = _("Do you really want to remove all post-fader redirects from this bus?\n"
+				   "(this cannot be undone)");
+		}
 	}
 
 	choices.push_back (_("Cancel"));
@@ -980,7 +990,7 @@
 	Gtkmm2ext::Choice prompter (prompt, choices);
 
 	if (prompter.run () == 1) {
-		_route->clear_redirects (this);
+		_route->clear_redirects (_placement, this);
 	}
 }
 
Index: libs/ardour/route.cc
===================================================================
--- libs/ardour/route.cc	(revision 139)
+++ libs/ardour/route.cc	(working copy)
@@ -112,7 +112,8 @@
 
 Route::~Route ()
 {
-	clear_redirects (this);
+	clear_redirects (PreFader, this);
+	clear_redirects (PostFader, this);
 
 	for (OrderKeys::iterator i = order_keys.begin(); i != order_keys.end(); ++i) {
 		free ((void*)(i->first));
@@ -924,10 +925,13 @@
 	return 0;
 }
 
+/** Remove redirects with a given placement.
+ * @param p Placement of redirects to remove.
+ */
 void
-Route::clear_redirects (void *src)
+Route::clear_redirects (Placement p, void *src)
 {
-	uint32_t old_rmo = redirect_max_outs;
+	const uint32_t old_rmo = redirect_max_outs;
 
 	if (!_session.engine().connected()) {
 		return;
@@ -935,13 +939,22 @@
 
 	{
 		Glib::RWLock::WriterLock lm (redirect_lock);
-		RedirectList::iterator i;
-		for (i = _redirects.begin(); i != _redirects.end(); ++i) {
-			(*i)->drop_references ();
+		RedirectList new_list;
+		
+		for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
+			if ((*i)->placement() == p) {
+				/* it's the placement we want to get rid of */
+				(*i)->drop_references ();
+			} else {
+				/* it's a different placement, so keep it */
+				new_list.push_back (*i);
+			}
 		}
-		_redirects.clear ();
+		
+		_redirects = new_list;
 	}
 
+	/* FIXME: can't see how this test can ever fire */
 	if (redirect_max_outs != old_rmo) {
 		reset_panner ();
 	}
@@ -1309,8 +1322,12 @@
 	}
 }
 
+/** Set all redirects with a given placement to a given active state.
+ * @param p Placement of redirects to change.
+ * @param state New active state for those redirects.
+ */
 void
-Route::all_redirects_active (bool state)
+Route::all_redirects_active (Placement p, bool state)
 {
 	Glib::RWLock::ReaderLock lm (redirect_lock);
 
@@ -1319,7 +1336,9 @@
 	}
 
 	for (RedirectList::iterator i = _redirects.begin(); i != _redirects.end(); ++i) {
-		(*i)->set_active (state, this);
+		if ((*i)->placement() == p) {
+			(*i)->set_active (state, this);
+		}
 	}
 }
 
Index: libs/ardour/ardour/route.h
===================================================================
--- libs/ardour/ardour/route.h	(revision 139)
+++ libs/ardour/ardour/route.h	(working copy)
@@ -169,9 +169,9 @@
 	int copy_redirects (const Route&, Placement, uint32_t* err_streams = 0);
 	int sort_redirects (uint32_t* err_streams = 0);
 
-	void clear_redirects (void *src);
+	void clear_redirects (Placement, void *src);
 	void all_redirects_flip();
-	void all_redirects_active (bool state);
+	void all_redirects_active (Placement, bool state);
 
 	virtual nframes_t update_total_latency();
 	nframes_t signal_latency() const { return _own_latency; }
1158.patch (4,376 bytes)   

cth103

2007-03-23 12:23

administrator   ~0003645

I am inclined to agree with you. I have attached a patch which fixes this, and also makes "activate all" behave in a similar way. Would you like to test it out and see what you think?

Thanks

Carl

slinkp

2007-03-23 15:22

reporter   ~0003647

What version does this patch apply to?
I'm still on 0.99.3, I'm guessing it's a patch for ardour 2?

cth103

2007-03-23 15:31

administrator   ~0003648

Yes it is a patch against ardour 2 (current SVN)

nowhiskey

2007-03-23 23:09

reporter   ~0003649

hi,
i don't know if the patch could make troubles somewhere else, cause i tested adour now just for short, but for me, the function of the patch works very well.

cheers,
doc

paul

2007-04-10 14:10

administrator   ~0003781

carl's patch applied to my source code. commit to follow.

Issue History

Date Modified Username Field Change
2005-12-01 04:03 slinkp New Issue
2007-03-23 12:22 cth103 File Added: 1158.patch
2007-03-23 12:23 cth103 Note Added: 0003645
2007-03-23 12:23 cth103 Status new => feedback
2007-03-23 15:22 slinkp Note Added: 0003647
2007-03-23 15:31 cth103 Note Added: 0003648
2007-03-23 23:09 nowhiskey Note Added: 0003649
2007-04-10 14:10 paul Status feedback => resolved
2007-04-10 14:10 paul Resolution open => fixed
2007-04-10 14:10 paul Assigned To => paul
2007-04-10 14:10 paul Note Added: 0003781
2008-11-21 00:30 seablade Status resolved => closed