View Issue Details

IDProjectCategoryView StatusLast Update
0001875ardourbugspublic2010-07-22 13:20
Reporteroofus Assigned Tocth103  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.8 
Summary0001875: MTC output stops, when the transport is in loop, when the playhead locates back to the beginning of the loop.
DescriptionMTC output stops, when the transport is in loop, when the playhead locates back to the beginning of the loop.
TagsNo tags attached.

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

2009-04-08 21:56: melkhorn (US$ 75)
2009-04-21 18:20: spm_gl (US$ 15)
2009-07-07 16:28: seablade (US$ 90)
  Users sponsoring this issue (Total Sponsorship = US$ 180)

Relationships

has duplicate 0002369 acknowledged Ardour stops sending MTC upon looping. 

Activities

oofus

2009-04-10 12:48

developer   ~0005881

Issue still present in 2.8.

2009-04-27 13:20

 

mtc.patch (3,801 bytes)   
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index b2f9197..fcdea2e 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -1367,6 +1367,8 @@ class Session : public PBD::StatefulDestructible
 	nframes_t  last_smpte_when;
 	SMPTE::Time last_smpte;
 
+	bool _send_smpte_update; ///< Flag to send a full frame (SMPTE) MTC message this cycle
+	
 	int send_full_time_code ();
 	int send_midi_time_code ();
 
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index ffa8eeb..b556589 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -284,6 +284,7 @@ Session::Session (AudioEngine &eng,
 	  state_tree (0),
 	  butler_mixdown_buffer (0),
 	  butler_gain_buffer (0),
+	  _send_smpte_update (false),
 	  midi_thread (pthread_t (0)),
 	  midi_requests (128), // the size of this should match the midi request pool size
 	  diskstreams (new DiskstreamList),
@@ -355,6 +356,7 @@ Session::Session (AudioEngine &eng,
 	  state_tree (0),
 	  butler_mixdown_buffer (0),
 	  butler_gain_buffer (0),
+	  _send_smpte_update (false),
 	  midi_thread (pthread_t (0)),
 	  midi_requests (16),
 	  diskstreams (new DiskstreamList),
diff --git a/libs/ardour/session_events.cc b/libs/ardour/session_events.cc
index 20e7309..f52a458 100644
--- a/libs/ardour/session_events.cc
+++ b/libs/ardour/session_events.cc
@@ -336,6 +336,7 @@ Session::process_event (Event* ev)
 			// cerr << "soft locate to " << ev->target_frame << endl;
 			start_locate (ev->target_frame, false, true, false);
 		}
+		_send_smpte_update = true;
 		break;
 
 	case Event::LocateRoll:
@@ -346,6 +347,7 @@ Session::process_event (Event* ev)
 			// cerr << "soft locate to+roll " << ev->target_frame << endl;
 			start_locate (ev->target_frame, true, true, false);
 		}
+		_send_smpte_update = true;
 		break;
 
 	case Event::LocateRollLocate:
diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc
index ffd30fb..1f0e085 100644
--- a/libs/ardour/session_midi.cc
+++ b/libs/ardour/session_midi.cc
@@ -762,6 +762,8 @@ Session::send_full_time_code ()
 	MIDI::byte msg[10];
 	SMPTE::Time smpte;
 
+	_send_smpte_update = false;
+
 	if (_mtc_port == 0 || !session_send_mtc) {
 		return 0;
 	}
@@ -829,14 +831,8 @@ Session::send_midi_time_code ()
 		return 0;
 	}
 
-	nframes_t two_smpte_frames_duration;
-	nframes_t quarter_frame_duration;
-
-	/* Duration of two smpte frames */
-	two_smpte_frames_duration = ((long) _frames_per_smpte_frame) << 1;
-
 	/* Duration of one quarter frame */
-	quarter_frame_duration = ((long) _frames_per_smpte_frame) >> 2;
+	nframes_t const quarter_frame_duration = ((long) _frames_per_smpte_frame) >> 2;
 
 	while (_transport_frame >= (outbound_mtc_smpte_frame + (next_quarter_frame_to_send * quarter_frame_duration))) {
 
diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc
index 8d831ee..7695b50 100644
--- a/libs/ardour/session_process.cc
+++ b/libs/ardour/session_process.cc
@@ -282,6 +282,14 @@ Session::process_with_events (nframes_t nframes)
 		process_event (ev);
 	}
 
+	/* Events caused a transport change, send an MTC Full Frame (SMPTE) message.
+	 * This is sent whether rolling or not, to give slaves an idea of ardour time
+	 * on locates (and allow slow slaves to position and prepare for rolling)
+	 */
+	if (_send_smpte_update) {
+		send_full_time_code ();
+	}
+
 	if (!process_can_proceed()) {
 		_silent = true;
 		return;
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 2801892..e306f05 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -773,6 +773,8 @@ Session::locate (nframes_t target_frame, bool with_roll, bool with_flush, bool w
 	}
 	
 	loop_changing = false;
+
+	_send_smpte_update = true;
 }
 
 void
mtc.patch (3,801 bytes)   

cth103

2009-04-27 13:21

administrator   ~0005907

Would you like to try the attached patch and let me know if it fixes things?
Thanks, Carl

seablade

2009-07-05 02:31

manager   ~0006287

Oofus did you ever try the patch? Would like to resolve out this issue and wouldn't complain about it being fixed either;)

oofus

2009-07-05 20:49

developer   ~0006352

I have a vague recollection that I did test this patch and that it fixed the issue, but I'm not 100% sure.

I someone could remind me if this patch is against 2.x_ongoing or 3.x I will test it again and report back.

seablade

2009-07-07 16:30

manager   ~0006391

Ok folks while we figure out what is going on with a bug that apparently clears out sponsorship when I update an issue, I have readded the sponsorship under my name(As I can't easily do it under the names of the people that sponsored it). Please treat this as being equivalent to your original sponsorship of the issue. Thanks.

We are trying to figure out why it got cleared out in the first place as it wasn't something that by default should have changed.

      Seablade

seablade

2009-07-07 16:32

manager   ~0006392

Ok I apologize aboutt he double post, apparently me adding any sponsorship to the issue reset the sponsorship and added mine on top...

I love bugs, have I mentioned this?

As a result the issue just got a nice boost that was unintended. Again not something easy for me to fix. Keep this in mind, Carl just get in touch with me over IRC if you have any questions? Thanks;)

cth103

2009-07-07 22:14

administrator   ~0006394

Hi all,

This patch still applies cleanly to 2.0-ongoing (or 2.8.1). Any test reports welcome.

I believe the bug is not present in 3.0, and again I'd be happy to hear of any reports either way.

pauarumi

2009-10-13 11:19

reporter   ~0006697

Patch tested on 2.0-ongoing Revision: 5768 (13 oct 09) and works well. I've tested with xjadeo. When ardours jumps to the loop start the xjadeo video keep stalled for some time (which is quite random, but i'd say less than <2000 ms) and then recovers with right timming.

This patch is very needed here - please apply.

paul

2009-10-13 21:22

administrator   ~0006702

patch applied and committed to the 2.0-ongoing branch. sorry that it missed the 2.8.3 release. if all bug sponsors consider the issue closed, it would be appropriate for bug sponsors to pay up anytime between now and 2.8.4. otherwise, please let carl know what you think is missing or still broken.

oofus

2009-10-19 12:32

developer   ~0006717

Having reported this originally, I can report that I think this is fixed and working as it should be. Thanks.

cth103

2009-10-19 13:48

administrator   ~0006718

Reporters says this is fixed. Thanks!

oofus

2010-07-22 13:20

developer   ~0008577

Fixed

Issue History

Date Modified Username Field Change
2007-09-18 23:48 oofus New Issue
2008-08-18 08:38 oofus Relationship added has duplicate 0002369
2009-04-08 21:56 melkhorn Sponsorship Added melkhorn: US$ 51
2009-04-08 21:56 melkhorn Sponsorship Total 0 => 51
2009-04-10 12:48 oofus Note Added: 0005881
2009-04-15 20:33 melkhorn Sponsorship Updated melkhorn: US$ 75
2009-04-15 20:33 melkhorn Sponsorship Total 51 => 75
2009-04-21 18:20 spm_gl Sponsorship Added spm_gl: US$ 15
2009-04-21 18:20 spm_gl Sponsorship Total 75 => 90
2009-04-27 13:20 cth103 File Added: mtc.patch
2009-04-27 13:21 cth103 Note Added: 0005907
2009-04-27 13:21 cth103 Status new => feedback
2009-07-05 02:31 seablade Note Added: 0006287
2009-07-05 02:32 seablade OS Mandriva =>
2009-07-05 02:32 seablade OS Version 2007 =>
2009-07-05 02:32 seablade Platform Dual 666MHz PIII =>
2009-07-05 02:32 seablade Build SVN 2468 =>
2009-07-05 02:32 seablade Sponsorship Total 90 => 0
2009-07-05 20:49 oofus Note Added: 0006352
2009-07-07 16:28 seablade cost => 0.00
2009-07-07 16:28 seablade Product Version 2.0 => 2.8
2009-07-07 16:28 seablade Sponsorship Added seablade: US$ 90
2009-07-07 16:28 seablade Sponsorship Total 0 => 180
2009-07-07 16:30 seablade Note Added: 0006391
2009-07-07 16:32 seablade Note Added: 0006392
2009-07-07 22:14 cth103 Note Added: 0006394
2009-10-13 11:19 pauarumi Note Added: 0006697
2009-10-13 21:22 paul Note Added: 0006702
2009-10-19 12:32 oofus Note Added: 0006717
2009-10-19 13:48 cth103 Note Added: 0006718
2009-10-19 13:48 cth103 Status feedback => resolved
2009-10-19 13:48 cth103 Resolution open => fixed
2009-10-19 13:48 cth103 Assigned To => cth103
2010-07-22 13:20 oofus Status resolved => feedback
2010-07-22 13:20 oofus Resolution fixed => reopened
2010-07-22 13:20 oofus Note Added: 0008577
2010-07-22 13:20 oofus Status feedback => closed
2010-07-22 13:20 oofus Resolution reopened => fixed