mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-07 11:27:44 +00:00
SHERLOCK: Add mutex to Sherlock MIDI parser
Hopefully this will put a stop to random crashes when music starts and/or stops. I'm never quite sure just how much locking is necessary, though...
This commit is contained in:
parent
8629feb410
commit
870d0d23a3
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user