Hi All,
I ran into a small glitch today, and I'm attaching a patch to fix it.
Setup: RG being used in conjunction with a dedicated digital
multitrack. The multitrack is an MTC master (so RG is set to MTC
slave) and is controlled via MMC so that I can start and stop the
multitrack from RG (RG is set to MMC master)
Situation: Hitting start play from RG is fine, but when I hit stop in
RG there is sometimes a race condition. The MMC stop command is sent
and stops the multitrack, but the multitrack may have at the same
moment sent an MTC quarter frame, which arrives in RG afterward. This
re-starts the RG transport, which dutifully sends an MMC start! :-)
Solution: when sending an MMC stop command, I set a flag to ignore the
next incoming MTC quarter frame (since it might be "stale"). See
attached patch. This fixes the problem for me, and should be safe in
other cases (since only one quarter frame is ever discarded.)
Vince
Index: AlsaDriver.h
===================================================================
--- AlsaDriver.h (revision 7326)
+++ AlsaDriver.h (working copy)
@@ -466,6 +466,7 @@
// MIDI Time Code handling:
+ bool m_eat_mtc;
// Received/emitted MTC data breakdown:
RealTime m_mtcReceiveTime;
RealTime m_mtcEncodedTime;
Index: AlsaDriver.cpp
===================================================================
--- AlsaDriver.cpp (revision 7326)
+++ AlsaDriver.cpp (working copy)
@@ -89,6 +89,7 @@
m_alsaRecordStartTime(0, 0),
m_loopStartTime(0, 0),
m_loopEndTime(0, 0),
+ m_eat_mtc(false),
m_looping(false),
m_haveShutdown(false)
#ifdef HAVE_LIBJACK
@@ -1843,6 +1844,8 @@
if (getMMCStatus() == TRANSPORT_MASTER)
{
sendMMC(127, MIDI_MMC_STOP, true, "");
+ //<VN> need to throw away the next MTC event
+ m_eat_mtc = true;
}
allNotesOff();
@@ -2745,7 +2748,12 @@
}
}
- } else {
+ } else if (m_eat_mtc) {
+#ifdef MTC_DEBUG
+ std::cerr << "MTC: Received quarter frame just after issuing MMC stop - ignore it" << std::endl;
+#endif
+ m_eat_mtc = false;
+ } else {
/* If we're not playing, we should be. */
#ifdef MTC_DEBUG
std::cerr << "MTC: Received quarter frame while not playing - starting now" << std::endl;
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel