renamed some Timer methods

svn-id: r10868
This commit is contained in:
Max Horn 2003-10-17 16:39:32 +00:00
parent 96a8d0ec1c
commit ad2db08940
9 changed files with 21 additions and 21 deletions

View file

@ -73,12 +73,12 @@ void Timer::release()
{ {
} }
bool Timer::installProcedure(TimerProc procedure, int32 interval) bool Timer::installTimerProc(TimerProc procedure, int32 interval)
{ {
return SendMsg(TSM_MSGID_ADDTIMER, procedure, interval); return SendMsg(TSM_MSGID_ADDTIMER, procedure, interval);
} }
void Timer::releaseProcedure(TimerProc procedure) void Timer::removeTimerProc(TimerProc procedure)
{ {
SendMsg(TSM_MSGID_REMTIMER, procedure, 0); SendMsg(TSM_MSGID_REMTIMER, procedure, 0);
} }

View file

@ -62,8 +62,8 @@ class Timer
bool init(); bool init();
void release(); void release();
bool installProcedure(TimerProc procedure, int32 interval); bool installTimerProc(TimerProc procedure, int32 interval);
void releaseProcedure(TimerProc procedure); void removeTimerProc(TimerProc procedure);
protected: protected:
bool SendMsg(ULONG MsgID, TimerProc procedure, LONG interval); bool SendMsg(ULONG MsgID, TimerProc procedure, LONG interval);

View file

@ -104,7 +104,7 @@ int Timer::handler(int t) {
return t; return t;
} }
bool Timer::installProcedure(TimerProc procedure, int32 interval, void *refCon) { bool Timer::installTimerProc(TimerProc procedure, int32 interval, void *refCon) {
assert(interval > 0); assert(interval > 0);
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
@ -122,7 +122,7 @@ bool Timer::installProcedure(TimerProc procedure, int32 interval, void *refCon)
return false; return false;
} }
void Timer::releaseProcedure(TimerProc procedure) { void Timer::removeTimerProc(TimerProc procedure) {
Common::StackLock lock(_mutex); Common::StackLock lock(_mutex);
for (int l = 0; l < MAX_TIMERS; l++) { for (int l = 0; l < MAX_TIMERS; l++) {

View file

@ -52,8 +52,8 @@ public:
Timer(OSystem *system); Timer(OSystem *system);
~Timer(); ~Timer();
bool installProcedure(TimerProc procedure, int32 interval, void *refCon); bool installTimerProc(TimerProc procedure, int32 interval, void *refCon);
void releaseProcedure(TimerProc procedure); void removeTimerProc(TimerProc procedure);
protected: protected:
static int timer_handler(int t); static int timer_handler(int t);

View file

@ -695,12 +695,12 @@ IMuseDigital::IMuseDigital(ScummEngine *scumm)
for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
_channel[l]._mixerChannel = 0; _channel[l]._mixerChannel = 0;
} }
_scumm->_timer->installProcedure(timer_handler, 200000, this); _scumm->_timer->installTimerProc(timer_handler, 200000, this);
_pause = false; _pause = false;
} }
IMuseDigital::~IMuseDigital() { IMuseDigital::~IMuseDigital() {
_scumm->_timer->releaseProcedure(timer_handler); _scumm->_timer->removeTimerProc(timer_handler);
for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) { for (int l = 0; l < MAX_DIGITAL_CHANNELS; l++) {
_scumm->_mixer->stopChannel(_channel[l]._mixerChannel); _scumm->_mixer->stopChannel(_channel[l]._mixerChannel);

View file

@ -260,13 +260,13 @@ void SmushPlayer::init() {
_smixer->_silentMixer = _scumm->_silentDigitalImuse; _smixer->_silentMixer = _scumm->_silentDigitalImuse;
_scumm->_smushPlay = true; _scumm->_smushPlay = true;
_dst = _scumm->virtscr[0].screenPtr + _scumm->virtscr[0].xstart; _dst = _scumm->virtscr[0].screenPtr + _scumm->virtscr[0].xstart;
_scumm->_timer->installProcedure(&timerCallback, _speed, _scumm); _scumm->_timer->installTimerProc(&timerCallback, _speed, _scumm);
_alreadyInit = false; _alreadyInit = false;
} }
void SmushPlayer::deinit() { void SmushPlayer::deinit() {
_scumm->_timer->releaseProcedure(&timerCallback); _scumm->_timer->removeTimerProc(&timerCallback);
_scumm->_smushPlay = false; _scumm->_smushPlay = false;
// In case the timerCallback is active right now, we loop till it finishes. // In case the timerCallback is active right now, we loop till it finishes.
// Note: even this still leaves a window for race conditions to occur. // Note: even this still leaves a window for race conditions to occur.

View file

@ -1044,7 +1044,7 @@ void Sound::playBundleMusic(const char *song) {
_bundleMusicTrack = 0; _bundleMusicTrack = 0;
_numberSamplesBundleMusic = _bundle->getNumberOfMusicSamplesByName(song); _numberSamplesBundleMusic = _bundle->getNumberOfMusicSamplesByName(song);
_nameBundleMusic = song; _nameBundleMusic = song;
_scumm->_timer->installProcedure(&music_handler, 1000000, this); _scumm->_timer->installTimerProc(&music_handler, 1000000, this);
} else if (strcmp(_nameBundleMusic, song) != 0) { } else if (strcmp(_nameBundleMusic, song) != 0) {
_newNameBundleMusic = song; _newNameBundleMusic = song;
_musicBundleToBeChanged = true; _musicBundleToBeChanged = true;
@ -1057,7 +1057,7 @@ void Sound::pauseBundleMusic(bool state) {
void Sound::stopBundleMusic() { void Sound::stopBundleMusic() {
// First stop the music timer // First stop the music timer
_scumm->_timer->releaseProcedure(&music_handler); _scumm->_timer->removeTimerProc(&music_handler);
_nameBundleMusic = ""; _nameBundleMusic = "";
_scumm->_mixer->stopChannel(_bundleMusicTrack); _scumm->_mixer->stopChannel(_bundleMusicTrack);
if (_musicBundleBufFinal) { if (_musicBundleBufFinal) {
@ -1412,12 +1412,12 @@ void Sound::startCDTimer() {
else else
timer_interval = 101; timer_interval = 101;
_scumm->_timer->releaseProcedure(&cd_timer_handler); _scumm->_timer->removeTimerProc(&cd_timer_handler);
_scumm->_timer->installProcedure(&cd_timer_handler, 1000 * timer_interval, _scumm); _scumm->_timer->installTimerProc(&cd_timer_handler, 1000 * timer_interval, _scumm);
} }
void Sound::stopCDTimer() { void Sound::stopCDTimer() {
_scumm->_timer->releaseProcedure(&cd_timer_handler); _scumm->_timer->removeTimerProc(&cd_timer_handler);
} }
void Sound::playCDTrack(int track, int numLoops, int startFrame, int duration) { void Sound::playCDTrack(int track, int numLoops, int startFrame, int duration) {

View file

@ -275,7 +275,7 @@ void SkyEngine::initialise(void) {
_skyMouse->useLogicInstance(_skyLogic); _skyMouse->useLogicInstance(_skyLogic);
_timer = Engine::_timer; // initialize timer *after* _skyScreen has been initialized. _timer = Engine::_timer; // initialize timer *after* _skyScreen has been initialized.
_timer->installProcedure(&timerHandler, 1000000 / 50, this); //call 50 times per second _timer->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second
_skyControl = new SkyControl(_skyScreen, _skyDisk, _skyMouse, _skyText, _skyMusic, _skyLogic, _skySound, _system, getSavePath()); _skyControl = new SkyControl(_skyScreen, _skyDisk, _skyMouse, _skyText, _skyMusic, _skyLogic, _skySound, _system, getSavePath());
_skyLogic->useControlInstance(_skyControl); _skyLogic->useControlInstance(_skyControl);

View file

@ -93,7 +93,7 @@ MidiDriver_MPU401::MidiDriver_MPU401() :
void MidiDriver_MPU401::close() { void MidiDriver_MPU401::close() {
if (_timer_proc) if (_timer_proc)
g_timer->releaseProcedure(_timer_proc); g_timer->removeTimerProc(_timer_proc);
_timer_proc = 0; _timer_proc = 0;
for (int i = 0; i < 16; ++i) for (int i = 0; i < 16; ++i)
send (0x7B << 8 | 0xB0 | i); send (0x7B << 8 | 0xB0 | i);
@ -128,9 +128,9 @@ MidiChannel *MidiDriver_MPU401::allocateChannel() {
void MidiDriver_MPU401::setTimerCallback(void *timer_param, TimerProc timer_proc) { void MidiDriver_MPU401::setTimerCallback(void *timer_param, TimerProc timer_proc) {
if (!_timer_proc || !timer_proc) { if (!_timer_proc || !timer_proc) {
if (_timer_proc) if (_timer_proc)
g_timer->releaseProcedure(_timer_proc); g_timer->removeTimerProc(_timer_proc);
_timer_proc = timer_proc; _timer_proc = timer_proc;
if (timer_proc) if (timer_proc)
g_timer->installProcedure(timer_proc, 10000, timer_param); g_timer->installTimerProc(timer_proc, 10000, timer_param);
} }
} }