Fix the speed throttle
[lsnes.git] / include / core / framerate.hpp
blob02334e54e96f612e54e10909d39fd5236c2bff80
1 #ifndef _framerate__hpp__included__
2 #define _framerate__hpp__included__
4 #include <cstdint>
6 /**
7 * Number clocks per field/frame on NTSC/PAL
8 */
9 #define DURATION_NTSC_FRAME 357366
10 #define DURATION_NTSC_FIELD 357368
11 #define DURATION_PAL_FRAME 425568
12 #define DURATION_PAL_FIELD 425568
14 /**
15 * Sets the nominal frame rate. Framerate limiting tries to maintain the nominal framerate when there is no other
16 * explict framerate to maintain.
18 void set_nominal_framerate(double fps) throw();
20 /**
21 * Returns the current realized framerate.
23 * returns: The framerate the system is currently archiving.
25 double get_framerate() throw();
27 /**
28 * Freeze time.
30 * Parameter usec: Current time in microseconds.
32 void freeze_time(uint64_t usec);
34 /**
35 * Unfreeze time.
37 * Parameter usec: Current time in microseconds.
39 void unfreeze_time(uint64_t usec);
41 /**
42 * Acknowledge frame start for timing purposes. If time is frozen, it is automatically unfrozen.
44 * parameter usec: Current time (relative to some unknown epoch) in microseconds.
46 void ack_frame_tick(uint64_t usec) throw();
48 /**
49 * Computes the number of microseconds to wait for next frame.
51 * parameter usec: Current time (relative to some unknown epoch) in microseconds.
52 * returns: Number of more microseconds to wait.
54 uint64_t to_wait_frame(uint64_t usec) throw();
56 /**
57 * Return microsecond-resolution time since unix epoch.
59 uint64_t get_utime();
61 /**
62 * Wait specified number of microseconds.
64 void wait_usec(uint64_t usec);
66 #endif