aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/music.cpp6
-rw-r--r--engines/sherlock/music.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp
index 1d4c6e08ee..470c6fafb3 100644
--- a/engines/sherlock/music.cpp
+++ b/engines/sherlock/music.cpp
@@ -21,6 +21,7 @@
*/
#include "common/config-manager.h"
+#include "common/mutex.h"
#include "sherlock/sherlock.h"
#include "sherlock/music.h"
#include "sherlock/scalpel/drivers/mididriver.h"
@@ -62,11 +63,14 @@ MidiParser_SH::MidiParser_SH() {
}
MidiParser_SH::~MidiParser_SH() {
+ Common::StackLock lock(_mutex);
unloadMusic();
_driver = NULL;
}
void MidiParser_SH::parseNextEvent(EventInfo &info) {
+ Common::StackLock lock(_mutex);
+
// warning("parseNextEvent");
// there is no delta right at the start of the music data
@@ -165,6 +169,8 @@ void MidiParser_SH::parseNextEvent(EventInfo &info) {
}
bool MidiParser_SH::loadMusic(byte *data, uint32 size) {
+ Common::StackLock lock(_mutex);
+
debugC(kDebugLevelMusic, "Music: loadMusic()");
unloadMusic();
diff --git a/engines/sherlock/music.h b/engines/sherlock/music.h
index 04b9dbd98e..2ebede9ea3 100644
--- a/engines/sherlock/music.h
+++ b/engines/sherlock/music.h
@@ -30,6 +30,7 @@
// for 3DO digital music
#include "audio/audiostream.h"
#include "audio/mixer.h"
+#include "common/mutex.h"
namespace Sherlock {
@@ -41,6 +42,7 @@ public:
~MidiParser_SH();
protected:
+ Common::Mutex _mutex;
virtual void parseNextEvent(EventInfo &info);
uint8 _beats;