diff options
-rw-r--r-- | base/engine.h | 4 | ||||
-rw-r--r-- | base/main.cpp | 2 | ||||
-rw-r--r-- | common/timer.cpp | 16 | ||||
-rw-r--r-- | common/timer.h | 8 | ||||
-rw-r--r-- | engines/agi/agi.cpp | 5 | ||||
-rw-r--r-- | sound/mididrv.h | 2 | ||||
-rw-r--r-- | sound/mpu401.cpp | 2 | ||||
-rw-r--r-- | sound/mpu401.h | 4 | ||||
-rw-r--r-- | sound/softsynth/emumidi.h | 4 | ||||
-rw-r--r-- | sound/softsynth/mt32.cpp | 6 |
10 files changed, 26 insertions, 27 deletions
diff --git a/base/engine.h b/base/engine.h index b9cc17a29c..e4055edb22 100644 --- a/base/engine.h +++ b/base/engine.h @@ -32,14 +32,14 @@ namespace Audio { } namespace Common { class SaveFileManager; - class Timer; + class TimerManager; } class Engine { public: OSystem *_system; Audio::Mixer *_mixer; - Common::Timer * _timer; + Common::TimerManager * _timer; protected: const Common::String _targetName; // target name for saves diff --git a/base/main.cpp b/base/main.cpp index 7c5042eb15..e65b589750 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -317,7 +317,7 @@ extern "C" int scummvm_main(int argc, char *argv[]) { system.initBackend(); // Create the timer services - Common::g_timer = new Common::Timer(&system); + Common::g_timer = new Common::TimerManager(&system); // Set initial window caption system.setWindowCaption(gScummVMFullVersion); diff --git a/common/timer.cpp b/common/timer.cpp index 0183cacd78..8ac033cf03 100644 --- a/common/timer.cpp +++ b/common/timer.cpp @@ -29,9 +29,9 @@ namespace Common { -Timer *g_timer = NULL; +TimerManager *g_timer = NULL; -Timer::Timer(OSystem *system) : +TimerManager::TimerManager(OSystem *system) : _system(system), _timerHandler(0), _lastTime(0) { @@ -51,10 +51,10 @@ Timer::Timer(OSystem *system) : } -Timer::~Timer() { +TimerManager::~TimerManager() { // Remove the timer callback. // Note: backends *must* gurantee that after this method call returns, - // the handler is not in use anymore; else race condtions could occurs. + // the handler is not in use anymore; else race condtions could occur. _system->setTimerCallback(0, 0); { @@ -67,13 +67,13 @@ Timer::~Timer() { } } -int Timer::timer_handler(int t) { +int TimerManager::timer_handler(int t) { if (g_timer) return g_timer->handler(t); return 0; } -int Timer::handler(int t) { +int TimerManager::handler(int t) { StackLock lock(_mutex); uint32 interval, l; @@ -97,7 +97,7 @@ int Timer::handler(int t) { return t; } -bool Timer::installTimerProc(TimerProc procedure, int32 interval, void *refCon) { +bool TimerManager::installTimerProc(TimerProc procedure, int32 interval, void *refCon) { assert(interval > 0); StackLock lock(_mutex); @@ -115,7 +115,7 @@ bool Timer::installTimerProc(TimerProc procedure, int32 interval, void *refCon) return false; } -void Timer::removeTimerProc(TimerProc procedure) { +void TimerManager::removeTimerProc(TimerProc procedure) { StackLock lock(_mutex); for (int l = 0; l < MAX_TIMERS; l++) { diff --git a/common/timer.h b/common/timer.h index f414895060..e0023cd2aa 100644 --- a/common/timer.h +++ b/common/timer.h @@ -36,7 +36,7 @@ class OSystem; namespace Common { -class Timer { +class TimerManager { public: typedef void (*TimerProc)(void *refCon); @@ -55,8 +55,8 @@ private: } _timerSlots[MAX_TIMERS]; public: - Timer(OSystem *system); - ~Timer(); + TimerManager(OSystem *system); + ~TimerManager(); /** * Install a new timer callback. It will from now be called every interval microseconds. @@ -82,7 +82,7 @@ protected: int handler(int t); }; -extern Timer *g_timer; +extern TimerManager *g_timer; } // End of namespace Common diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 8225e5dcdb..c91d7b5a61 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -269,9 +269,8 @@ int agi_get_keypress_low() { return k; } -static uint32 agi_timer_function_low(uint32 i) { +static void agi_timer_function_low(void *refCon) { tick_timer++; - return i; } static void init_pri_table() { @@ -526,7 +525,7 @@ void AgiEngine::initialize() { init_video(); tick_timer = 0; - Common::g_timer->installTimerProc((Common::Timer::TimerProc) agi_timer_function_low, 10 * 1000, NULL); + Common::g_timer->installTimerProc(agi_timer_function_low, 10 * 1000, NULL); game.ver = -1; /* Don't display the conf file warning */ diff --git a/sound/mididrv.h b/sound/mididrv.h index 4c9ab81855..b2d4d37aa0 100644 --- a/sound/mididrv.h +++ b/sound/mididrv.h @@ -190,7 +190,7 @@ public: virtual void metaEvent(byte type, byte *data, uint16 length) { } // Timing functions - MidiDriver now operates timers - virtual void setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc) = 0; + virtual void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) = 0; /** The time in microseconds between invocations of the timer callback. */ virtual uint32 getBaseTempo(void) = 0; diff --git a/sound/mpu401.cpp b/sound/mpu401.cpp index 7d6c3ff5ee..58c00b4e6a 100644 --- a/sound/mpu401.cpp +++ b/sound/mpu401.cpp @@ -131,7 +131,7 @@ MidiChannel *MidiDriver_MPU401::allocateChannel() { return NULL; } -void MidiDriver_MPU401::setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc) { +void MidiDriver_MPU401::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) { if (!_timer_proc || !timer_proc) { if (_timer_proc) Common::g_timer->removeTimerProc(_timer_proc); diff --git a/sound/mpu401.h b/sound/mpu401.h index 1c7b0b00f7..bbdb490585 100644 --- a/sound/mpu401.h +++ b/sound/mpu401.h @@ -71,14 +71,14 @@ public: class MidiDriver_MPU401 : public MidiDriver { private: MidiChannel_MPU401 _midi_channels[16]; - Common::Timer::TimerProc _timer_proc; + Common::TimerManager::TimerProc _timer_proc; uint16 _channel_mask; public: MidiDriver_MPU401(); virtual void close(); - void setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc); + void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc); uint32 getBaseTempo(void) { return 10000; } uint32 property(int prop, uint32 param); diff --git a/sound/softsynth/emumidi.h b/sound/softsynth/emumidi.h index 89124b8024..557e9b04cc 100644 --- a/sound/softsynth/emumidi.h +++ b/sound/softsynth/emumidi.h @@ -32,7 +32,7 @@ protected: Audio::Mixer *_mixer; private: - Common::Timer::TimerProc _timerProc; + Common::TimerManager::TimerProc _timerProc; void *_timerParam; int _nextTick; @@ -70,7 +70,7 @@ public: return 0; } - void setTimerCallback(void *timer_param, Common::Timer::TimerProc timer_proc) { + void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) { _timerProc = timer_proc; _timerParam = timer_param; } diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp index 1f3434c581..57ab87cb08 100644 --- a/sound/softsynth/mt32.cpp +++ b/sound/softsynth/mt32.cpp @@ -391,7 +391,7 @@ class MidiDriver_ThreadedMT32 : public MidiDriver_MT32 { private: OSystem::Mutex _eventMutex; MidiEvent_MT32 *_events; - Timer::TimerProc _timer_proc; + TimerManager::TimerProc _timer_proc; void pushMidiEvent(MidiEvent_MT32 *event); MidiEvent_MT32 *popMidiEvent(); @@ -405,7 +405,7 @@ public: void onTimer(); void close(); - void setTimerCallback(void *timer_param, Timer::TimerProc timer_proc); + void setTimerCallback(void *timer_param, TimerManager::TimerProc timer_proc); }; @@ -421,7 +421,7 @@ void MidiDriver_ThreadedMT32::close() { } } -void MidiDriver_ThreadedMT32::setTimerCallback(void *timer_param, Timer::TimerProc timer_proc) { +void MidiDriver_ThreadedMT32::setTimerCallback(void *timer_param, TimerManager::TimerProc timer_proc) { if (!_timer_proc || !timer_proc) { if (_timer_proc) g_timer->removeTimerProc(_timer_proc); |