Create function pointer to lua function adapter and migrate what we can
[lsnes.git] / avsnoop.hpp
blobd397f3dfabf75581f8e7d456de1dd3dc7a50b3b8
1 #ifndef _avsnoop__hpp__included__
2 #define _avsnoop__hpp__included__
4 #include "render.hpp"
5 #include <list>
6 #include <string>
7 #include <stdexcept>
9 /**
10 * A/V snooper.
12 class av_snooper
14 public:
15 /**
16 * Create new A/V snooper.
18 * throws std::bad_alloc: Not enough memory.
20 av_snooper() throw(std::bad_alloc);
22 /**
23 * Destroy A/V snooper. This will not call end method.
25 ~av_snooper() throw();
27 /**
28 * Dump a frame.
30 * parameter _frame: The frame to dump.
31 * parameter fps_n: Current fps numerator.
32 * parameter fps_d: Current fps denomerator.
33 * throws std::bad_alloc: Not enough memory.
34 * throws std::runtime_error: Error dumping frame.
36 virtual void frame(struct lcscreen& _frame, uint32_t fps_n, uint32_t fps_d) throw(std::bad_alloc,
37 std::runtime_error) = 0;
39 /**
40 * Dump a frame.
42 * parameter _frame: The frame to dump.
43 * parameter fps_n: Current fps numerator.
44 * parameter fps_d: Current fps denomerator.
45 * throws std::bad_alloc: Not enough memory.
47 static void frame(struct lcscreen& _frame, uint32_t fps_n, uint32_t fps_d, bool dummy)
48 throw(std::bad_alloc);
50 /**
51 * Dump a sample.
53 * parameter l: Left channel sample.
54 * parameter r: Right channel sample.
55 * throws std::bad_alloc: Not enough memory.
56 * throws std::runtime_error: Error dumping sample.
58 virtual void sample(short l, short r) throw(std::bad_alloc, std::runtime_error) = 0;
60 /**
61 * Dump a sample.
63 * parameter l: Left channel sample.
64 * parameter r: Right channel sample.
65 * throws std::bad_alloc: Not enough memory.
67 static void sample(short l, short r, bool dummy) throw(std::bad_alloc);
69 /**
70 * End dump.
72 * throws std::bad_alloc: Not enough memory.
73 * throws std::runtime_error: Error dumping sample.
75 virtual void end() throw(std::bad_alloc, std::runtime_error) = 0;
77 /**
78 * End dump.
80 * throws std::bad_alloc: Not enough memory.
82 static void end(bool dummy) throw(std::bad_alloc);
84 /**
85 * Notify game information.
87 * parameter gamename: Name of the game.
88 * parameter authors: Authors of the run.
89 * parameter gametime: Game time.
90 * parameter rercords: Rerecord count.
91 * throws std::bad_alloc: Not enough memory.
92 * throws std::runtime_error: Error recording this info.
94 virtual void gameinfo(const std::string& gamename, const std::list<std::pair<std::string, std::string>>&
95 authors, double gametime, const std::string& rerecords) throw(std::bad_alloc, std::runtime_error) = 0;
97 /**
98 * Notify game information.
100 * parameter gamename: Name of the game.
101 * parameter authors: Authors of the run.
102 * parameter gametime: Game time.
103 * parameter rercords: Rerecord count.
104 * throws std::bad_alloc Not enough memory.
106 static void gameinfo(const std::string& gamename, const std::list<std::pair<std::string, std::string>>&
107 authors, double gametime, const std::string& rerecords, bool dummy) throw(std::bad_alloc);
110 * Send game info. This causes gameinfo method to be called on object this method is called on.
112 void send_gameinfo() throw();
115 * Is there dump in progress?
117 * returns: True if dump is in progress, false if not.
119 static bool dump_in_progress() throw();
122 * Notifier for dumps starting/ending.
124 class dump_notification
126 public:
128 * Destructor.
130 virtual ~dump_notification() throw();
132 * New dump starting.
134 virtual void dump_starting() throw();
136 * Dump ending.
138 virtual void dump_ending() throw();
142 * Add a notifier.
144 * parameter notifier: New notifier to add.
146 static void add_dump_notifier(dump_notification& notifier) throw(std::bad_alloc);
149 * Remove a notifier.
151 * parameter notifier: Existing notifier to remove.
153 static void remove_dump_notifier(dump_notification& notifier) throw();
156 #endif