Here's an updated roll-up patch that supercedes the previous two. It's
the "integration with external recorders" patch, so to speak.
The external (MMC-controlled) recorder now follows the RG transport on
any position jump, such as clicking on a marker, clicking on the time
ruler, etc.
Note that although ideally we should use 25fps (for easy maths) some
equipment only understands 30fps. So at the moment I send that, which
should always work (until we find the one that doesn't.. groan)
Vince
Index: AlsaDriver.h
===================================================================
*** AlsaDriver.h (revision 7326)
--- AlsaDriver.h (working copy)
***************
*** 464,473 ****
--- 464,474 ----
RealTime m_loopStartTime;
RealTime m_loopEndTime;
// MIDI Time Code handling:
+ unsigned int m_eat_mtc;
// Received/emitted MTC data breakdown:
RealTime m_mtcReceiveTime;
RealTime m_mtcEncodedTime;
int m_mtcFrames;
int m_mtcSeconds;
Index: AlsaDriver.cpp
===================================================================
*** AlsaDriver.cpp (revision 7326)
--- AlsaDriver.cpp (working copy)
***************
*** 87,96 ****
--- 87,97 ----
m_midiSyncAutoConnect(false),
m_alsaPlayStartTime(0, 0),
m_alsaRecordStartTime(0, 0),
m_loopStartTime(0, 0),
m_loopEndTime(0, 0),
+ m_eat_mtc(0),
m_looping(false),
m_haveShutdown(false)
#ifdef HAVE_LIBJACK
,m_jackDriver(0)
#endif
***************
*** 1817,1826 ****
--- 1818,1828 ----
m_mtcSigmaE = 0;
m_mtcSigmaC = 0;
if (getMMCStatus() == TRANSPORT_MASTER) {
sendMMC(127, MIDI_MMC_PLAY, true, "");
+ m_eat_mtc = 0;
}
if (getMTCStatus() == TRANSPORT_MASTER) {
insertMTCFullFrame(position);
}
***************
*** 1841,1850 ****
--- 1843,1854 ----
#endif
if (getMMCStatus() == TRANSPORT_MASTER)
{
sendMMC(127, MIDI_MMC_STOP, true, "");
+ //<VN> need to throw away the next MTC event
+ m_eat_mtc = 3;
}
allNotesOff();
m_playing = false;
***************
*** 1952,1961 ****
--- 1956,1996 ----
{
#ifdef DEBUG_ALSA
std::cerr << "\n\nAlsaDriver - resetPlayback(" << position << ")" << std::endl;
#endif
+ if (getMMCStatus() == TRANSPORT_MASTER)
+ {
+ unsigned char t_sec = (unsigned char) position.sec % 60;
+ unsigned char t_min = (unsigned char) (position.sec / 60) % 60;
+ unsigned char t_hrs = (unsigned char) (position.sec / 3600);
+ #define STUPID_BROKEN_EQUIPMENT
+ #ifdef STUPID_BROKEN_EQUIPMENT
+ // Some recorders assume you are talking in 30fps...
+ unsigned char t_frm = (unsigned char) (position.nsec / 33333333U);
+ unsigned char t_sbf = (unsigned char) ((position.nsec / 333333U) % 100U);
+ #else
+ // We always send at 25fps, it's the easiest to avoid rounding problems
+ unsigned char t_frm = (unsigned char) (position.nsec / 40000000U);
+ unsigned char t_sbf = (unsigned char) ((position.nsec / 400000U) % 100U);
+ #endif
+
+ std::cerr << "\n Jump using MMC LOCATE to" << position << std::endl;
+ std::cerr << "\t which is " << int(t_hrs) <<":" << int(t_min) << ":" << int(t_sec) << "." << int(t_frm) << "." << int(t_sbf) << std::endl;
+ unsigned char locateDataArr[7] = {
+ 0x06,
+ 0x01,
+ 0x60 + t_hrs, // (30fps flag) + hh
+ t_min, // mm
+ t_sec, // ss
+ t_frm, // frames
+ t_sbf // subframes
+ };
+
+ sendMMC(127, MIDI_MMC_LOCATE, true, std::string((const char *) locateDataArr, 7));
+ }
+
m_playStartPosition = position;
m_alsaPlayStartTime = getAlsaTime();
// Reset note offs to correct positions
//
***************
*** 2715,2725 ****
--- 2750,2762 ----
#endif
calibrateMTC();
RealTime t_diff = m_mtcEncodedTime - m_mtcReceiveTime;
+ #ifdef MTC_DEBUG
std::cerr << "Diff: "<< t_diff << endl;
+ #endif
/* -ve diff means ALSA time ahead of MTC time */
if (t_diff.sec > 0) {
tweakSkewForMTC(60000);
***************
*** 2743,2753 ****
else {
lock_count = 0;
}
}
! } 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;
#endif
ExternalTransport *transport = getExternalTransportControl();
--- 2780,2795 ----
else {
lock_count = 0;
}
}
! } else if (m_eat_mtc > 0) {
! #ifdef MTC_DEBUG
! std::cerr << "MTC: Received quarter frame just after issuing MMC stop - ignore it" << std::endl;
! #endif
! --m_eat_mtc;
! } 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;
#endif
ExternalTransport *transport = getExternalTransportControl();
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