diff options
Diffstat (limited to 'simon/midi.cpp')
-rw-r--r-- | simon/midi.cpp | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/simon/midi.cpp b/simon/midi.cpp index b658bd1f54..a9d04d411d 100644 --- a/simon/midi.cpp +++ b/simon/midi.cpp @@ -56,7 +56,7 @@ MidiPlayer::MidiPlayer(OSystem *system) { // this is where we'll initialize stuff that must persist // between songs. _system = system; - _mutex = system->create_mutex(); + _mutex = system->createMutex(); _driver = 0; _map_mt32_to_gm = false; @@ -74,10 +74,10 @@ MidiPlayer::MidiPlayer(OSystem *system) { } MidiPlayer::~MidiPlayer() { - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); close(); - _system->unlock_mutex(_mutex); - _system->delete_mutex(_mutex); + _system->unlockMutex(_mutex); + _system->deleteMutex(_mutex); } int MidiPlayer::open() { @@ -94,12 +94,12 @@ int MidiPlayer::open() { void MidiPlayer::close() { stop(); -// _system->lock_mutex (_mutex); +// _system->lockMutex (_mutex); if (_driver) _driver->close(); _driver = NULL; clearConstructs(); -// _system->unlock_mutex (_mutex); +// _system->unlockMutex (_mutex); } void MidiPlayer::send(uint32 b) { @@ -150,9 +150,9 @@ void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) { // Have to unlock it before calling jump() // (which locks it itself), and then relock it // upon returning. - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); startTrack (destination); - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); } else { stop(); } @@ -160,7 +160,7 @@ void MidiPlayer::metaEvent (byte type, byte *data, uint16 length) { void MidiPlayer::onTimer (void *data) { MidiPlayer *p = (MidiPlayer *) data; - p->_system->lock_mutex(p->_mutex); + p->_system->lockMutex(p->_mutex); if (!p->_paused) { if (p->_music.parser && p->_currentTrack != 255) { p->_current = &p->_music; @@ -172,7 +172,7 @@ void MidiPlayer::onTimer (void *data) { p->_sfx.parser->onTimer(); } p->_current = 0; - p->_system->unlock_mutex(p->_mutex); + p->_system->unlockMutex(p->_mutex); } void MidiPlayer::startTrack (int track) { @@ -183,7 +183,7 @@ void MidiPlayer::startTrack (int track) { if (track >= _music.num_songs) return; - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); if (_music.parser) { _current = &_music; @@ -205,9 +205,9 @@ void MidiPlayer::startTrack (int track) { _currentTrack = (byte) track; _music.parser = parser; // That plugs the power cord into the wall } else if (_music.parser) { - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); if (!_music.parser->setTrack(track)) { - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); return; } _currentTrack = (byte) track; @@ -216,18 +216,18 @@ void MidiPlayer::startTrack (int track) { _current = 0; } - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } void MidiPlayer::stop() { - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); if (_music.parser) { _current = &_music; _music.parser->jumpToTick(0); } _current = 0; _currentTrack = 255; - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } void MidiPlayer::pause (bool b) { @@ -235,14 +235,14 @@ void MidiPlayer::pause (bool b) { return; _paused = b; - _system->lock_mutex(_mutex); + _system->lockMutex(_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->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } void MidiPlayer::set_volume (int volume) { @@ -256,7 +256,7 @@ void MidiPlayer::set_volume (int volume) { _masterVolume = volume; // Now tell all the channels this. - _system->lock_mutex (_mutex); + _system->lockMutex (_mutex); if (_driver && !_paused) { for (int i = 0; i < 16; ++i) { if (_music.channel[i]) @@ -265,7 +265,7 @@ void MidiPlayer::set_volume (int volume) { _sfx.channel[i]->volume(_sfx.volume[i] * _masterVolume / 255); } } - _system->unlock_mutex (_mutex); + _system->unlockMutex (_mutex); } void MidiPlayer::set_driver(MidiDriver *md) { @@ -276,27 +276,27 @@ void MidiPlayer::set_driver(MidiDriver *md) { } void MidiPlayer::mapMT32toGM (bool map) { - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); _map_mt32_to_gm = map; - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } void MidiPlayer::setLoop (bool loop) { - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); _loopTrack = loop; - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } void MidiPlayer::queueTrack (int track, bool loop) { - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); if (_currentTrack == 255) { - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); setLoop(loop); startTrack(track); } else { _queuedTrack = track; _loopQueuedTrack = loop; - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } } @@ -351,7 +351,7 @@ static int simon1_gmf_size[] = { }; void MidiPlayer::loadSMF (File *in, int song, bool sfx) { - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); MusicInfo *p = sfx ? &_sfx : &_music; clearConstructs (*p); @@ -418,7 +418,7 @@ void MidiPlayer::loadSMF (File *in, int song, bool sfx) { resetVolumeTable(); } p->parser = parser; // That plugs the power cord into the wall - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } void MidiPlayer::loadMultipleSMF (File *in, bool sfx) { @@ -431,14 +431,14 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) { // We need to load ALL the songs and then // treat them as separate tracks -- for the // purpose of jumps, anyway. - _system->lock_mutex(_mutex); + _system->lockMutex(_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->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); return; } @@ -451,7 +451,7 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) { 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->unlock_mutex (_mutex); + _system->unlockMutex (_mutex); return; } in->seek(in->readUint32BE() + in->pos(), SEEK_SET); @@ -476,11 +476,11 @@ void MidiPlayer::loadMultipleSMF (File *in, bool sfx) { _currentTrack = 255; resetVolumeTable(); } - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } void MidiPlayer::loadXMIDI(File *in, bool sfx) { - _system->lock_mutex(_mutex); + _system->lockMutex(_mutex); MusicInfo *p = sfx ? &_sfx : &_music; clearConstructs(*p); @@ -499,7 +499,7 @@ void MidiPlayer::loadXMIDI(File *in, bool sfx) { } if (memcmp(buf, "CAT ", 4)) { warning("Could not find 'CAT ' tag to determine resource size!"); - _system->unlock_mutex (_mutex); + _system->unlockMutex (_mutex); return; } size += 4 + in->readUint32BE(); @@ -508,7 +508,7 @@ void MidiPlayer::loadXMIDI(File *in, bool sfx) { 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->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); return; } @@ -526,18 +526,18 @@ void MidiPlayer::loadXMIDI(File *in, bool sfx) { resetVolumeTable(); } p->parser = parser; // That plugs the power cord into the wall - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } void MidiPlayer::loadS1D (File *in, bool sfx) { - _system->lock_mutex(_mutex); + _system->lockMutex(_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->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); return; } @@ -558,7 +558,7 @@ void MidiPlayer::loadS1D (File *in, bool sfx) { resetVolumeTable(); } p->parser = parser; // That plugs the power cord into the wall - _system->unlock_mutex(_mutex); + _system->unlockMutex(_mutex); } } // End of namespace Simon |