Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.9 KiB

  1. // Copyright (c) 1996-2000 Microsoft Corporation. All rights reserved.
  2. /* PLClock.h
  3. */
  4. #ifndef __PLCLOCK_H__
  5. #define __PLCLOCK_H__
  6. #define IReferenceClock IMasterClock
  7. /*****************************************************************************
  8. * class CPhaseLockClock
  9. *****************************************************************************
  10. * This implements a clock that phase locks two reference clocks.
  11. */
  12. class CPhaseLockClock
  13. {
  14. public:
  15. CPhaseLockClock();
  16. void Start(REFERENCE_TIME rfMasterTime, REFERENCE_TIME rfSlaveTime);
  17. void GetSlaveTime(REFERENCE_TIME rfSlaveTime,REFERENCE_TIME *prfTime);
  18. void SetSlaveTime(REFERENCE_TIME rfSlaveTime,REFERENCE_TIME *prfTime);
  19. void SyncToMaster(REFERENCE_TIME rfSlaveTime, REFERENCE_TIME rfMasterTime);
  20. private:
  21. REFERENCE_TIME m_rfOffset;
  22. };
  23. /*****************************************************************************
  24. * class CSampleClock
  25. *****************************************************************************
  26. * This implements a clock that translates between a sample time and a
  27. * reference time, doing any phase locking in a child CPhaseLockClock object.
  28. */
  29. class CSampleClock
  30. {
  31. public:
  32. CSampleClock();
  33. void Start(IReferenceClock *pIClock, DWORD dwSampleRate, LONGLONG llSampleTime);
  34. void SampleToRefTime(LONGLONG llSampleTime,REFERENCE_TIME *prfTime);
  35. void SyncToMaster(LONGLONG llSampleTime, IReferenceClock *pIClock);
  36. void SyncToMaster(REFERENCE_TIME rfSlaveTime, REFERENCE_TIME rfMasterTime);
  37. LONGLONG RefTimeToSample(REFERENCE_TIME rfTime);
  38. private:
  39. CPhaseLockClock m_PLClock;
  40. LONGLONG m_llStart; // Initial sample offset.
  41. REFERENCE_TIME m_rfStart;
  42. DWORD m_dwSampleRate;
  43. };
  44. #endif // __PLCLOCK_H__