View Issue Details

IDProjectCategoryView StatusLast Update
0002794ardourbugspublic2011-11-28 01:08
Reporternickm Assigned Topaul  
PrioritynormalSeveritymajorReproducibilityalways
Status feedbackResolutionreopened 
Product VersionSVN/2.0-ongoing 
Target Version2.8.12 
Summary0002794: [PATCH] Creating a send from a bus to another bus results in out of sync audio until after a session reload
DescriptionSteps to reproduce:

1. Download my 14MB test session from http://nickm.net/national-copy.tar.gz
2. Start ardour and load the session
3. Create a new send with two output on the Drums bus, connected to the Drums Rev bus
4. Activate the send
5. Start playback and note that audio playing through Drums Rev is out of sync with the rest of the session (confirm by muting and un-muting the bus)
6. Save changes and close ardour
7. Start ardour and load the same session
8. Start playback - audio playing through Drums Rev is now in sync with the rest of the session

I found it impossible to reproduce with a trivial session but it is 100% reproducible on real world sessions, so it may be dependent on track count or routing complexity...
Tagsfixed in A3

  Users sponsoring this issue
Sponsors List Total Sponsorship = US$ 50

2009-07-28 02:06: nickm (US$ 50)
  Users sponsoring this issue (Total Sponsorship = US$ 50)

Activities

nettings

2009-08-15 02:15

manager   ~0006533

can't reproduce this using your session with r5499.
i followed your recipe, and recorded the left channel of the drums bus and the left channel of the drums rev bus into a new stereo track. they were perfectly in sync.

do you still have this issue?

nickm

2009-08-15 17:39

reporter   ~0006554

Yes the issue has been present in ardour for ages and is still present.

You shouldn't need to record anything, it should be obvious during playback.

Since it doesn't happen on trivial sessions and you can't reproduce, I guess it may be load related...

kernel_geek

2010-04-02 14:46

reporter   ~0007431

nickm: I have this issue, I had to move all my drums back and foward verying amounts, between 50 and 250 smpte frames. Even w/o reverb I have issues. My tracks go into a drum bus, then into a master bus, then to my card.

nickm

2010-04-02 18:01

reporter   ~0007432

This bug is about the fact that when the session is first loaded everything is in sync, but that certain actions on buses can cause the audio routed through those buses to go out of sync. Reload the session and everything is in sync again. Is this the problem you are having kernel_geek?

kernel_geek

2010-04-03 09:48

reporter   ~0007435

No. I adjusted the positions of my regions and now they're in sync even after a close/save/reboot/open etc.. I reset the positions of the regions in question and connected the output of the bus to my sound card direct (parallel with the other buses) and this solved the problem. Should I start a new bug then ?

cth103

2010-04-05 21:36

administrator   ~0007445

I can reproduce this with A3.

cth103

2010-04-06 00:30

administrator   ~0007447

Perhaps you could try the attached patch against 2.0 and let me know if it helps?

2010-04-06 00:35

 

2794.patch (1,651 bytes)   
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 124d48a..a4787c8 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1070,7 +1070,7 @@ class Session : public PBD::StatefulDestructible
 		set_worst_io_latencies ();
 	}
 
-	void update_latency_compensation_proxy (void* ignored);
+	void route_redirects_changed (void* ignored);
 
 	void ensure_passthru_buffers (uint32_t howmany);
 	
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index f279153..cb06256 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -2186,7 +2186,7 @@ Session::add_routes (RouteList& new_routes, bool save)
 		(*x)->solo_changed.connect (sigc::bind (mem_fun (*this, &Session::route_solo_changed), wpr));
 		(*x)->mute_changed.connect (mem_fun (*this, &Session::route_mute_changed));
 		(*x)->output_changed.connect (mem_fun (*this, &Session::set_worst_io_latencies_x));
-		(*x)->redirects_changed.connect (mem_fun (*this, &Session::update_latency_compensation_proxy));
+		(*x)->redirects_changed.connect (mem_fun (*this, &Session::route_redirects_changed));
 		
 		if ((*x)->master()) {
 			_master_out = (*x);
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index d7b0e04..efcb0bd 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -1385,9 +1385,10 @@ Session::update_latency_compensation (bool with_stop, bool abort)
 }
 
 void
-Session::update_latency_compensation_proxy (void* ignored)
+Session::route_redirects_changed (void* ignored)
 {
 	update_latency_compensation (false, false);
+	resort_routes ();
 }
 
 void
2794.patch (1,651 bytes)   

cth103

2010-04-06 12:14

administrator   ~0007448

I have committed an equivalent fix to A3 SVN.

kernel_geek

2010-04-06 12:44

reporter   ~0007449

cth103: I can try the patch this evening (thats 5 hours by my timezone)

paul

2010-04-28 21:15

administrator   ~0007641

patch applied to 2.0-ongoing (rev 7014), not needed for 3.0.

nickm

2010-07-02 16:34

reporter   ~0008374

I'm not convinced this is fixed - in fact it seems to have worsened in the latest version. I can now trigger it just by inserted a plugin on a track :(

nickm

2010-08-02 13:08

reporter   ~0008693

Commenting out the call to resort_routes in Session::route_redirects_changed fixes the problem. So it seems fairly certain that the patch introduces a far worse problem - inserting a plugin on a track causes tracks to go out of sync with each other. Removing the plugin restores correct sync. This patch should be reverted ASAP. NB: I can't reproduce the plugin problem on a new session so it seems this is also related to session size perhaps...

cth103

2010-09-24 14:29

administrator   ~0009158

Last edited: 2010-09-24 14:30

Where are you inserting the plugin, what plugin is it and what tracks does it cause to be delayed?

nickm

2010-10-09 19:32

reporter   ~0009232

I'm inserting the plugin pre-fader, on any track.

It's hard to tell exactly which tracks are out of sync as its a big mix, but its pretty obvious that something is wrong when it happens.

cth103

2010-11-20 00:17

administrator   ~0009447

I'd be interested to see if adding the attached route-sort.patch (keeping 2794.patch in as well) helps at all.

2010-11-20 00:48

 

route-sort2.patch (1,378 bytes)   
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index 543f5f9..1084040 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -1611,10 +1611,14 @@ Session::set_default_fade (float steepness, float fade_msecs)
 }
 
 struct RouteSorter {
+    /** @return true to run r1 before r2, otherwise false */
     bool operator() (boost::shared_ptr<Route> r1, boost::shared_ptr<Route> r2) {
+	    bool interesting = false;
 	    if (r1->fed_by.find (r2) != r1->fed_by.end()) {
+		    /* r1 fed by r2; run r2 early */
 		    return false;
 	    } else if (r2->fed_by.find (r1) != r2->fed_by.end()) {
+		    /* r2 fed by r1; run r1 early */
 		    return true;
 	    } else {
 		    if (r1->fed_by.empty()) {
@@ -1626,7 +1630,13 @@ struct RouteSorter {
 				    return true;
 			    }
 		    } else {
-			    return r1->order_key(N_("signal")) < r2->order_key(N_("signal"));
+			    if (r2->fed_by.empty()) {
+				    /* r1 has connections, r2 does not; run r2 early */
+				    return false;
+			    } else {
+				    /* both r1 and r2 have connections, but not to each other. just use signal order */
+				    return r1->order_key(N_("signal")) < r2->order_key(N_("signal"));
+			    }
 		    }
 	    }
     }
@@ -1749,7 +1759,7 @@ Session::resort_routes_using (shared_ptr<RouteList> r)
 	}
 	cerr << endl;
 #endif
-	
+
 }
 
 list<boost::shared_ptr<AudioTrack> >
route-sort2.patch (1,378 bytes)   

plutek

2010-11-20 15:28

reporter   ~0009451

i have a session which was consistently causing this issue, also with some busses which did *not* have plugins on them, but which did have sends to other busses. i sent the session to cth103 and he wrote route-sort2.patch -- since applying the patch, i have not yet been able to make any busses fall out of sync in that session! i've added/removed/disabled/enabled plugins and sends, and everything seems to just keep rolling in sync.

i'd say, so far, this appears to be a break-through on this issue.

big thanks, cth103!

cth103

2010-11-21 00:50

administrator   ~0009457

Thanks for the testing plutek!

I've applied this patch to 3.0 SVN.

plutek

2010-11-21 04:19

reporter   ~0009458

not being applied to the 2.0 branch? so i'll patch every time i update from svn?

cth103

2010-11-21 11:49

administrator   ~0009459

It will probably be applied to 2.0 soon.

plutek

2010-11-23 16:52

reporter   ~0009484

another report, a few days in, just to confirm.... i've done a lot of work over the last couple of days, with other sessions similar to the one i sent to cth103. everything still appears to be fine.

nickm

2010-12-04 22:40

reporter   ~0009547

I've tried your patch and I can still trigger the problem if I change a track's outputs from the master bus to some other bus... but I'm not sure if this is related or not?

cth103

2010-12-08 01:21

administrator   ~0009572

Last edited: 2010-12-11 01:59

Do you have a repeatable test case for that? And are you using both patches from this bug?

cth103

2011-11-28 01:08

administrator   ~0012224

For what it's worth at this late stage, I think A3 contains a fix which stands a good chance of solving this problem; if it is still affecting people we can look at a backport.

Issue History

Date Modified Username Field Change
2009-07-27 16:42 nickm New Issue
2009-07-28 02:06 nickm Sponsorship Added nickm: US$ 50
2009-07-28 02:06 nickm Sponsorship Total 0 => 50
2009-08-15 02:15 nettings Note Added: 0006533
2009-08-15 02:15 nettings Status new => feedback
2009-08-15 17:39 nickm Note Added: 0006554
2010-04-02 14:46 kernel_geek Note Added: 0007431
2010-04-02 18:01 nickm Note Added: 0007432
2010-04-03 09:48 kernel_geek Note Added: 0007435
2010-04-05 21:36 cth103 Note Added: 0007445
2010-04-05 21:36 cth103 Status feedback => confirmed
2010-04-06 00:29 cth103 File Added: 2794.patch
2010-04-06 00:30 cth103 Note Added: 0007447
2010-04-06 00:30 cth103 Status confirmed => feedback
2010-04-06 00:31 cth103 File Deleted: 2794.patch
2010-04-06 00:31 cth103 File Added: 2794.patch
2010-04-06 00:35 cth103 File Deleted: 2794.patch
2010-04-06 00:35 cth103 File Added: 2794.patch
2010-04-06 12:14 cth103 Note Added: 0007448
2010-04-06 12:44 kernel_geek Note Added: 0007449
2010-04-24 10:28 cth103 Category bugs => bugs2
2010-04-24 10:29 cth103 Category bugs2 => bugs
2010-04-26 13:38 cth103 Tag Attached: fixed in A3
2010-04-28 21:15 paul cost => 0.00
2010-04-28 21:15 paul Note Added: 0007641
2010-04-28 21:15 paul Status feedback => resolved
2010-04-28 21:15 paul Resolution open => fixed
2010-04-28 21:15 paul Assigned To => paul
2010-07-02 16:34 nickm Note Added: 0008374
2010-07-02 16:34 nickm Status resolved => feedback
2010-07-02 16:34 nickm Resolution fixed => reopened
2010-08-02 13:08 nickm Note Added: 0008693
2010-08-05 14:40 cth103 Target Version => 2.8.12
2010-09-24 14:29 cth103 Note Added: 0009158
2010-09-24 14:30 cth103 Note Edited: 0009158
2010-10-09 19:32 nickm Note Added: 0009232
2010-11-20 00:16 cth103 File Added: route-sort.patch
2010-11-20 00:17 cth103 Note Added: 0009447
2010-11-20 00:48 cth103 File Deleted: route-sort.patch
2010-11-20 00:48 cth103 File Added: route-sort2.patch
2010-11-20 15:28 plutek Note Added: 0009451
2010-11-21 00:50 cth103 Note Added: 0009457
2010-11-21 04:19 plutek Note Added: 0009458
2010-11-21 11:49 cth103 Note Added: 0009459
2010-11-23 16:52 plutek Note Added: 0009484
2010-12-04 22:40 nickm Note Added: 0009547
2010-12-08 01:21 cth103 Note Added: 0009572
2010-12-11 01:59 cth103 Note Edited: 0009572
2011-03-07 18:23 cth103 Summary Creating a send from a bus to another bus results in out of sync audio until after a session reload => [PATCH] Creating a send from a bus to another bus results in out of sync audio until after a session reload
2011-11-28 01:08 cth103 Note Added: 0012224