[Scummvm-cvs-logs] CVS: scummvm/simon midi.cpp,1.66,1.67 midi.h,1.27,1.28
Max Horn
fingolfin at users.sourceforge.net
Fri Jan 28 15:54:13 CET 2005
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5365/simon
Modified Files:
midi.cpp midi.h
Log Message:
Use class Mutex instead of MutexRef
Index: midi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/midi.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- midi.cpp 1 Jan 2005 16:09:19 -0000 1.66
+++ midi.cpp 28 Jan 2005 22:05:46 -0000 1.67
@@ -55,8 +55,6 @@
// Since initialize() is called every time the music changes,
// this is where we'll initialize stuff that must persist
// between songs.
- _system = system;
- _mutex = system->createMutex();
_driver = 0;
_map_mt32_to_gm = false;
_passThrough = false;
@@ -75,10 +73,9 @@
}
MidiPlayer::~MidiPlayer() {
- _system->lockMutex(_mutex);
+ _mutex.lock();
close();
- _system->unlockMutex(_mutex);
- _system->deleteMutex(_mutex);
+ _mutex.unlock();
}
int MidiPlayer::open() {
@@ -156,9 +153,9 @@
// Have to unlock it before calling jump()
// (which locks it itself), and then relock it
// upon returning.
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
startTrack (destination);
- _system->lockMutex(_mutex);
+ _mutex.lock();
} else {
stop();
}
@@ -189,7 +186,7 @@
if (track >= _music.num_songs)
return;
- _system->lockMutex(_mutex);
+ _mutex.lock();
if (_music.parser) {
_current = &_music;
@@ -211,9 +208,9 @@
_currentTrack = (byte) track;
_music.parser = parser; // That plugs the power cord into the wall
} else if (_music.parser) {
- _system->lockMutex(_mutex);
+ _mutex.lock();
if (!_music.parser->setTrack(track)) {
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
return;
}
_currentTrack = (byte) track;
@@ -222,7 +219,7 @@
_current = 0;
}
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
}
void MidiPlayer::stop() {
@@ -292,15 +289,15 @@
}
void MidiPlayer::queueTrack (int track, bool loop) {
- _system->lockMutex(_mutex);
+ _mutex.lock();
if (_currentTrack == 255) {
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
setLoop(loop);
startTrack(track);
} else {
_queuedTrack = track;
_loopQueuedTrack = loop;
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
}
}
Index: midi.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/midi.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- midi.h 10 Jan 2005 22:06:13 -0000 1.27
+++ midi.h 28 Jan 2005 22:05:46 -0000 1.28
@@ -27,7 +27,6 @@
#include "common/mutex.h"
class File;
-class OSystem;
namespace Simon {
@@ -52,8 +51,7 @@
class MidiPlayer : public MidiDriver {
protected:
- OSystem *_system;
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
MidiDriver *_driver;
bool _map_mt32_to_gm;
bool _passThrough;
More information about the Scummvm-git-logs
mailing list