mFilterAray[mCurrentPosition - (1 > > currentFilterDepth, mFilterRate[currentFilterDepth] * kDecimate (currentDilterDepth - 1 ); SYTRACE (~T(''PI: F= %164d S=%164d RF= %164d RS=%164d depth= %d curPos= %d\n''), pi.mFrame, pi.mSample, pi.mRate.mFrame, pi.mRate.mSample, currentFilterDepth, mCurrentPosition); #endif mPass = 0; // Store the filter point again, since the array size has been doubled to simplify indexing mFllterArray[mCurrentPosltlon - (1 a kMaxFilterDepth)] = mFllterArray[mCurrentPosition - 1] + filterPoint; // Move to the net position in the filter array mCurrentPosition++; mCurrentPosition & = (1 kmaxFilterDepth) - 1; mCurrentPosition I= 1 kMaxFilterDepth; void SyNewRateControl: :TrackFrames SyFilterPipeItem & newFilterPoint, // newFilterPoint is an input to the function, all following args are outputs IEEE32 & currentRate, IEEE326 newRate, TimeCode & position, TimeStamp & rateTimeStamp, TlmeStamp & commandTimeStamp // This is the frame tracker, which calculates the rates and timestamps needed by the transport controller commandTimeStamp = this- > GetReferenceTime rateTimeStamp = commandTimeStamp; if (rateTimeStamp rateTimeStamp = mCueTimeStamp; ASSERT ((Int32)newFilterPoint.mRate.mSAmple > 0); TimeStamp nextRateTimeStamp = commandTimeStamp + (TimeStamp)newFilterPoint.mRate.mSample; currentRate = (IEEE32) (newFilterPoint.mRate.mFrame) / newFilterPolnt.mRate.mRate.mSample; //SYTRACE(~(T"cr: %f, mFrame: %I64d, mSample: %I164d\n"), (float) currentRate, // newFilterPoint.mRate.mFrame, newFilterPoint.mRate.mSample); ::SyEnterCriticalSection( & mTransportCS); position = mActualPosition + mLastActualRate * (rateTimeStamp mLastActualRateTimeStamp); ::SyLeaveCriticalSection( & mTransportCS); TimeCode desiredNextPosition = newFilterPoint.mFrame + (TimeCode) (currentRate * (nextRateTimeStamp (TimesTamp)newFilterPoint.mSample)); newRate = (IEEE32) (desiredNextPosition - position / (nextRateTimeStamp rateTimeStamp); void else newRate = 1.0; else if newRate newRate > -1.0 - kRateTolerance & & error if (reverseSyncLockDelay = = INFINITE SYNCLOCK DELAY) mUnityRateTimer = 0; else if (mUnityRateTimer > reverseSyncLockDelay) // Use a tighter rate window before actually locking into reverse play speed if newRate newRate > -1.0 - kRateTolerance / 8 & & error mUnityRateTimer--; else newRate = -1.0; else mUnityRateTimer = 0; #ifdef ~TRACE~OUTPUT~DELTA static SyFilterPipeItem lastFilterPoint; SYRELTRACE T("FPD: F=%I64d S=%I64d\n"), newFilterPoint.mFrame - lastFilterPoint.mFrame, newFilterPoint.mSample - lastFilterPoint.mSample SYRELTRACE ~T("FRP: F=%I64d S=%I64d\n"), newFilterPoint.mRate.mFrame - lastFilterPoint.mRate.mFrame, newFilterPoint . mRate.mSample - lastFilterPoint.mRate.mSample lastFilterPoint = newFilterPoint; tèndif #if defined(~DEBUG) || defined(NDEBUG) //#define ~TRACE #ifdef TRACE SYRELTRACE T("CT: fp=%I64u, %I64u fr=I64d,%I64d curRate=%f newRate=%f pos=%I64d rateTS=%lu cmdTS=%lu\n"), newFilterPoint.mFrame, newFilterPoint.mSample, newFilterPoint.mRate.mFrame, newFilterPolnt.mRate.mSample, currentRate, newRate, position, rateTimeStamp, commandTimeStamp SYRELTRACE T(" actPos=%lf desPos=%I64u error=%s%I64d depth=%d curPos=%d\n"), mActualPosition, desiredPosition, position > desiredPosition ? ~T("-") : ~T(""), error, newFilterPoint.mDepth, newFilterPoint.mPosition ): #endif #endif // If the error is more than kMaxChaseError and the rate is maxed out, cue the transport If error > kMaxChaseError & & SY::abs(newRate) = = kMaxRate this - > CueHint(currentRate) & -mCueHlnt mCueHint = this - > CueHint(currentRate); TimeStamp cueDelay = this - > GetCueDelay() (int) (mCueHint = = CUEHINT ~BIDIRECTIONAL) ; if ((Int32)cueDelay cueDelay = newFilterPoint.mRate.mSample; mCueTimeStamp = commandTimeStamp + cueDelay; newRate = 0.0; if (newRate i= mLastActualRate) this- > SetTransportRate (newRate, commandTimeStamp); // SYTRACE(~T("nfp.mFrame: %I64d, cr: %f, cts: %d, nfp.mSample: %I64d\n"), // newFilterPoint.mFrame, (float) currentRate, (Int32) mCueTimeStamp, // newFilterPoint.mSample); position = newFilterPoint.mFrame + (TimeCode) (currentRate * (mCueTimeStamp - TimeStamp)newFilterPoint.mSample)); if (SY::abs(currentRate) this- > CueTransport(position, commandTimeStamp, mCueHint); else // The following call to Cue used to be called to handle the case // where CalculateRate wasn't called for a long time.