aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2007-08-22 15:28:31 +0000
committerFilippos Karapetis2007-08-22 15:28:31 +0000
commitcd3f8577c1c75fba1b8aabf7d7c8447f945e5d65 (patch)
tree2aa1c6d412632f9520e02ad1ed73febe40d87ec1 /engines
parent532c8c4230f6e9dcea58642094b893da0f0f75a5 (diff)
downloadscummvm-rg350-cd3f8577c1c75fba1b8aabf7d7c8447f945e5d65.tar.gz
scummvm-rg350-cd3f8577c1c75fba1b8aabf7d7c8447f945e5d65.tar.bz2
scummvm-rg350-cd3f8577c1c75fba1b8aabf7d7c8447f945e5d65.zip
Mutexes are now used in the MIDI music playing code
svn-id: r28697
Diffstat (limited to 'engines')
-rw-r--r--engines/saga/music.cpp4
-rw-r--r--engines/saga/music.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/engines/saga/music.cpp b/engines/saga/music.cpp
index 61d0438d2b..11c3fa3f58 100644
--- a/engines/saga/music.cpp
+++ b/engines/saga/music.cpp
@@ -320,6 +320,8 @@ void MusicPlayer::metaEvent(byte type, byte *data, uint16 length) {
void MusicPlayer::onTimer(void *refCon) {
MusicPlayer *music = (MusicPlayer *)refCon;
+ Common::StackLock lock(music->_mutex);
+
if (music->_isPlaying)
music->_parser->onTimer();
}
@@ -329,6 +331,8 @@ void MusicPlayer::playMusic() {
}
void MusicPlayer::stopMusic() {
+ Common::StackLock lock(_mutex);
+
_isPlaying = false;
if (_parser) {
_parser->unloadMusic();
diff --git a/engines/saga/music.h b/engines/saga/music.h
index b038a25a11..036fcbf897 100644
--- a/engines/saga/music.h
+++ b/engines/saga/music.h
@@ -34,6 +34,7 @@
#include "sound/mp3.h"
#include "sound/vorbis.h"
#include "sound/flac.h"
+#include "common/mutex.h"
namespace Saga {
@@ -77,6 +78,7 @@ public:
MidiChannel *getPercussionChannel() { return 0; }
MidiParser *_parser;
+ Common::Mutex _mutex;
protected: