Evdev joystick plugin
[lsnes.git] / generic / framerate.hpp
blob1fef5e04a76b595bab7dd1cc7153194d6ccaae1a
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 * Acknowledge frame start for timing purposes.
30 * parameter usec: Current time (relative to some unknown epoch) in microseconds.
32 void ack_frame_tick(uint64_t usec) throw();
34 /**
35 * Computes the number of microseconds to wait for next frame.
37 * parameter usec: Current time (relative to some unknown epoch) in microseconds.
38 * returns: Number of more microseconds to wait.
40 uint64_t to_wait_frame(uint64_t usec) throw();
42 /**
43 * Return microsecond-resolution time since unix epoch.
45 uint64_t get_utime();
47 /**
48 * Wait specified number of microseconds.
50 void wait_usec(uint64_t usec);
52 #endif