3rdparty/licenseReport: Add seperate LGPL checks
[haiku.git] / src / add-ons / media / media-add-ons / multi_audio / TimeComputer.h
blob89aae6dcacf3a272c54f460da0975c39d11ff95f
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef TIME_COMPUTER_H
6 #define TIME_COMPUTER_H
9 #include <SupportDefs.h>
12 struct TimeComputer {
13 TimeComputer();
15 void Init(float frameRate, bigtime_t realBaseTime);
16 void SetFrameRate(float frameRate);
18 void AddTimeStamp(bigtime_t realTime, uint64 frames);
20 bigtime_t RealTime() const { return fRealTime; }
21 bigtime_t PerformanceTime() const
22 { return fPerformanceTime; }
23 double Drift() const { return fDrift; }
25 private:
26 static const int32 kEntryCount = 32;
28 struct Entry {
29 bigtime_t realTime;
30 bigtime_t performanceTime;
33 private:
34 void _AddEntry(bigtime_t realTime,
35 bigtime_t performanceTime);
37 private:
38 bigtime_t fRealTime;
39 bigtime_t fPerformanceTime;
40 double fDrift;
41 float fFrameRate;
42 double fUsecsPerFrame;
43 bigtime_t fPerformanceTimeBase;
44 uint64 fFrameBase;
45 bool fResetTimeBase;
46 Entry fEntries[kEntryCount];
47 int32 fFirstEntry;
48 int32 fLastEntry;
52 #endif // TIME_COMPUTER_H