1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#ifndef EMULATION_TIMING_HXX
19#define EMULATION_TIMING_HXX
20
21#include "bspf.hxx"
22#include "FrameLayout.hxx"
23#include "ConsoleTiming.hxx"
24
25class EmulationTiming {
26 public:
27
28 EmulationTiming(FrameLayout frameLayout = FrameLayout::ntsc, ConsoleTiming consoleTiming = ConsoleTiming::ntsc);
29
30 EmulationTiming& updateFrameLayout(FrameLayout frameLayout);
31
32 EmulationTiming& updateConsoleTiming(ConsoleTiming consoleTiming);
33
34 EmulationTiming& updatePlaybackRate(uInt32 playbackRate);
35
36 EmulationTiming& updatePlaybackPeriod(uInt32 period);
37
38 EmulationTiming& updateAudioQueueExtraFragments(uInt32 audioQueueExtraFragments);
39
40 EmulationTiming& updateAudioQueueHeadroom(uInt32 audioQueueHeadroom);
41
42 EmulationTiming& updateSpeedFactor(float speedFactor);
43
44 uInt32 maxCyclesPerTimeslice() const;
45
46 uInt32 minCyclesPerTimeslice() const;
47
48 uInt32 linesPerFrame() const;
49
50 uInt32 cyclesPerFrame() const;
51
52 uInt32 cyclesPerSecond() const;
53
54 uInt32 audioFragmentSize() const;
55
56 uInt32 audioSampleRate() const;
57
58 uInt32 audioQueueCapacity() const;
59
60 uInt32 prebufferFragmentCount() const;
61
62 private:
63
64 void recalculate();
65
66 private:
67
68 FrameLayout myFrameLayout;
69 ConsoleTiming myConsoleTiming;
70
71 uInt32 myPlaybackRate;
72 uInt32 myPlaybackPeriod;
73 uInt32 myAudioQueueExtraFragments;
74 uInt32 myAudioQueueHeadroom;
75
76 uInt32 myMaxCyclesPerTimeslice;
77 uInt32 myMinCyclesPerTimeslice;
78 uInt32 myLinesPerFrame;
79 uInt32 myCyclesPerFrame;
80 uInt32 myCyclesPerSecond;
81 uInt32 myAudioFragmentSize;
82 uInt32 myAudioSampleRate;
83 uInt32 myAudioQueueCapacity;
84 uInt32 myPrebufferFragmentCount;
85
86 double mySpeedFactor;
87
88 private:
89
90 EmulationTiming(const EmulationTiming&) = delete;
91 EmulationTiming(EmulationTiming&&) = delete;
92 EmulationTiming& operator=(const EmulationTiming&) = delete;
93 EmulationTiming& operator=(EmulationTiming&&) = delete;
94
95};
96
97#endif // EMULATION_TIMING_HXX
98