Continuous latency problems

I’m not sure if this is the right direction to take this, but…

  • The server (on Mac) does clock sync in SC_CoreAudio.cpp, syncOSCOffsetWithTimeOfDay(). This function is called every 20 seconds (see resyncThreadFunc() immediately below it).
  • The language does clock sync in PyrSched.cpp, syncOSCOffsetWithTimeOfDay() – also called every 20 seconds (resyncThread()).

Since these are in different processes, those 20-second cycles are not synchronized. Normally this shouldn’t be a problem, because any drift should be on the order of fractions of milliseconds.

The actual gHostOSCoffset ends up being time of day (obtained in the same way in both language and server, so these should definitely correspond) minus “system time.”

The server side uses AudioGetCurrentHostTime() for “system time,” while the language side uses high_resolution_clock::now().time_since_epoch(). Perhaps sometimes, in Mac, these values differ more than expected?

That’s certainly out of my depth, but AFAICS, if there are language-vs-server time discrepancies, this is where they would occur.

hjh

1 Like