[Scummvm-cvs-logs] CVS: scummvm/simon midi.cpp,1.62,1.63
Max Horn
fingolfin at users.sourceforge.net
Fri Sep 3 17:05:13 CEST 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm NEWS,1.76,1.77
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.276,1.277 actor.h,1.58,1.59 akos.cpp,1.153,1.154 base-costume.h,1.24,1.25 script_v7he.cpp,2.60,2.61
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30840
Modified Files:
midi.cpp
Log Message:
cleanup
Index: midi.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/midi.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -d -r1.62 -r1.63
--- midi.cpp 28 Feb 2004 12:58:11 -0000 1.62
+++ midi.cpp 4 Sep 2004 00:04:36 -0000 1.63
@@ -160,7 +160,8 @@
void MidiPlayer::onTimer (void *data) {
MidiPlayer *p = (MidiPlayer *) data;
- p->_system->lockMutex(p->_mutex);
+ Common::StackLock lock(p->_mutex);
+
if (!p->_paused) {
if (p->_music.parser && p->_currentTrack != 255) {
p->_current = &p->_music;
@@ -172,7 +173,6 @@
p->_sfx.parser->onTimer();
}
p->_current = 0;
- p->_system->unlockMutex(p->_mutex);
}
void MidiPlayer::startTrack (int track) {
@@ -220,14 +220,14 @@
}
void MidiPlayer::stop() {
- _system->lockMutex(_mutex);
+ Common::StackLock lock(_mutex);
+
if (_music.parser) {
_current = &_music;
_music.parser->jumpToTick(0);
}
_current = 0;
_currentTrack = 255;
- _system->unlockMutex(_mutex);
}
void MidiPlayer::pause (bool b) {
@@ -235,14 +235,13 @@
return;
_paused = b;
- _system->lockMutex(_mutex);
+ Common::StackLock lock(_mutex);
for (int i = 0; i < 16; ++i) {
if (_music.channel[i])
_music.channel[i]->volume (_paused ? 0 : (_music.volume[i] * _masterVolume / 255));
if (_sfx.channel[i])
_sfx.channel[i]->volume (_paused ? 0 : (_sfx.volume[i] * _masterVolume / 255));
}
- _system->unlockMutex(_mutex);
}
void MidiPlayer::set_volume (int volume) {
@@ -256,7 +255,7 @@
_masterVolume = volume;
// Now tell all the channels this.
- _system->lockMutex (_mutex);
+ Common::StackLock lock(_mutex);
if (_driver && !_paused) {
for (int i = 0; i < 16; ++i) {
if (_music.channel[i])
@@ -265,7 +264,6 @@
_sfx.channel[i]->volume(_sfx.volume[i] * _masterVolume / 255);
}
}
- _system->unlockMutex (_mutex);
}
void MidiPlayer::set_driver(MidiDriver *md) {
@@ -276,15 +274,15 @@
}
void MidiPlayer::mapMT32toGM (bool map) {
- _system->lockMutex(_mutex);
+ Common::StackLock lock(_mutex);
+
_map_mt32_to_gm = map;
- _system->unlockMutex(_mutex);
}
void MidiPlayer::setLoop (bool loop) {
- _system->lockMutex(_mutex);
+ Common::StackLock lock(_mutex);
+
_loopTrack = loop;
- _system->unlockMutex(_mutex);
}
void MidiPlayer::queueTrack (int track, bool loop) {
@@ -351,7 +349,8 @@
};
void MidiPlayer::loadSMF (File *in, int song, bool sfx) {
- _system->lockMutex(_mutex);
+ Common::StackLock lock(_mutex);
+
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs (*p);
@@ -418,7 +417,6 @@
resetVolumeTable();
}
p->parser = parser; // That plugs the power cord into the wall
- _system->unlockMutex(_mutex);
}
void MidiPlayer::loadMultipleSMF (File *in, bool sfx) {
@@ -431,14 +429,14 @@
// We need to load ALL the songs and then
// treat them as separate tracks -- for the
// purpose of jumps, anyway.
- _system->lockMutex(_mutex);
+ Common::StackLock lock(_mutex);
+
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs(*p);
p->num_songs = in->readByte();
if (p->num_songs > 16) {
printf ("playMultipleSMF: %d is too many songs to keep track of!\n", (int) p->num_songs);
- _system->unlockMutex(_mutex);
return;
}
@@ -451,7 +449,6 @@
in->read(buf, 4);
if (memcmp (buf, "MThd", 4)) {
printf ("Expected MThd but found '%c%c%c%c' instead!\n", buf[0], buf[1], buf[2], buf[3]);
- _system->unlockMutex (_mutex);
return;
}
in->seek(in->readUint32BE() + in->pos(), SEEK_SET);
@@ -476,11 +473,10 @@
_currentTrack = 255;
resetVolumeTable();
}
- _system->unlockMutex(_mutex);
}
void MidiPlayer::loadXMIDI(File *in, bool sfx) {
- _system->lockMutex(_mutex);
+ Common::StackLock lock(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs(*p);
@@ -499,7 +495,6 @@
}
if (memcmp(buf, "CAT ", 4)) {
warning("Could not find 'CAT ' tag to determine resource size!");
- _system->unlockMutex (_mutex);
return;
}
size += 4 + in->readUint32BE();
@@ -508,7 +503,6 @@
in->read(p->data, size);
} else {
warning("Expected 'FORM' tag but found '%c%c%c%c' instead!", buf[0], buf[1], buf[2], buf[3]);
- _system->unlockMutex(_mutex);
return;
}
@@ -526,18 +520,16 @@
resetVolumeTable();
}
p->parser = parser; // That plugs the power cord into the wall
- _system->unlockMutex(_mutex);
}
void MidiPlayer::loadS1D (File *in, bool sfx) {
- _system->lockMutex(_mutex);
+ Common::StackLock lock(_mutex);
MusicInfo *p = sfx ? &_sfx : &_music;
clearConstructs(*p);
uint16 size = in->readUint16LE();
if (size != in->size() - 2) {
warning("Size mismatch in simon1demo MUS file (%ld versus reported %d)", (long) in->size() - 2, (int) size);
- _system->unlockMutex(_mutex);
return;
}
@@ -558,7 +550,6 @@
resetVolumeTable();
}
p->parser = parser; // That plugs the power cord into the wall
- _system->unlockMutex(_mutex);
}
} // End of namespace Simon
- Previous message: [Scummvm-cvs-logs] CVS: scummvm NEWS,1.76,1.77
- Next message: [Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.276,1.277 actor.h,1.58,1.59 akos.cpp,1.153,1.154 base-costume.h,1.24,1.25 script_v7he.cpp,2.60,2.61
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list