aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/timer.cpp5
-rw-r--r--common/timer.h2
-rw-r--r--scumm/imuse_digi/dimuse.cpp2
-rw-r--r--scumm/imuse_digi/dimuse.h2
-rw-r--r--scumm/player_v2.cpp8
-rw-r--r--scumm/player_v2.h3
-rw-r--r--scumm/sound.cpp6
-rw-r--r--simon/midi.cpp25
-rw-r--r--simon/midi.h4
-rw-r--r--sky/music/adlibmusic.cpp4
-rw-r--r--sky/music/adlibmusic.h2
-rw-r--r--sky/music/gmmusic.cpp4
-rw-r--r--sky/music/gmmusic.h2
-rw-r--r--sky/music/mt32music.cpp4
-rw-r--r--sky/music/mt32music.h2
-rw-r--r--sky/music/musicbase.cpp13
-rw-r--r--sky/music/musicbase.h7
-rw-r--r--sky/sky.cpp6
-rw-r--r--sound/mixer.cpp3
-rw-r--r--sound/mixer.h2
-rw-r--r--sound/softsynth/mt32.cpp14
-rw-r--r--sword1/music.cpp6
-rw-r--r--sword1/music.h5
-rw-r--r--sword1/sword1.cpp2
-rw-r--r--sword2/sound.cpp4
-rw-r--r--sword2/sound.h4
26 files changed, 46 insertions, 95 deletions
diff --git a/common/timer.cpp b/common/timer.cpp
index 230366ad0d..2075243106 100644
--- a/common/timer.cpp
+++ b/common/timer.cpp
@@ -30,12 +30,9 @@ Timer *g_timer = NULL;
Timer::Timer(OSystem *system) :
_system(system),
- _mutex(0),
_timerHandler(0),
_lastTime(0) {
- _mutex = _system->createMutex();
-
g_timer = this;
for (int i = 0; i < MAX_TIMERS; i++) {
@@ -65,8 +62,6 @@ Timer::~Timer() {
_timerSlots[i].counter = 0;
}
}
-
- _system->deleteMutex(_mutex);
}
int Timer::timer_handler(int t) {
diff --git a/common/timer.h b/common/timer.h
index 6b3509f41c..d509402314 100644
--- a/common/timer.h
+++ b/common/timer.h
@@ -39,7 +39,7 @@ public:
private:
OSystem *_system;
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
void *_timerHandler;
int32 _thisTime;
int32 _lastTime;
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp
index 764d618358..af8259b23a 100644
--- a/scumm/imuse_digi/dimuse.cpp
+++ b/scumm/imuse_digi/dimuse.cpp
@@ -44,7 +44,6 @@ void IMuseDigital::timer_handler(void *refCon) {
IMuseDigital::IMuseDigital(ScummEngine *scumm, int fps)
: _vm(scumm) {
- _mutex = g_system->createMutex();
_pause = false;
_sound = new ImuseDigiSndMgr(_vm);
_callbackFps = fps;
@@ -64,7 +63,6 @@ IMuseDigital::~IMuseDigital() {
delete _track[l];
}
delete _sound;
- g_system->deleteMutex(_mutex);
}
void IMuseDigital::resetState() {
diff --git a/scumm/imuse_digi/dimuse.h b/scumm/imuse_digi/dimuse.h
index 8a6e95519a..dcec24b109 100644
--- a/scumm/imuse_digi/dimuse.h
+++ b/scumm/imuse_digi/dimuse.h
@@ -86,7 +86,7 @@ private:
Track *_track[MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS];
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
ScummEngine *_vm;
ImuseDigiSndMgr *_sound;
diff --git a/scumm/player_v2.cpp b/scumm/player_v2.cpp
index 7a9db4fb0e..f142372b0d 100644
--- a/scumm/player_v2.cpp
+++ b/scumm/player_v2.cpp
@@ -22,7 +22,6 @@
#include "stdafx.h"
#include "base/engine.h"
-#include "common/system.h"
#include "scumm/player_v2.h"
#include "scumm/scumm.h"
#include "sound/mididrv.h"
@@ -347,10 +346,8 @@ Player_V2::Player_V2(ScummEngine *scumm, bool pcjr) {
_isV3Game = (scumm->_version >= 3);
_vm = scumm;
- _system = scumm->_system;
_mixer = scumm->_mixer;
_sample_rate = _mixer->getOutputRate();
- _mutex = _system->createMutex();
_header_len = (scumm->_features & GF_OLD_BUNDLE) ? 4 : 6;
@@ -385,7 +382,6 @@ Player_V2::~Player_V2() {
// Detach the premix callback handler
_mixer->setupPremix(0);
mutex_down();
- _system->deleteMutex (_mutex);
}
void Player_V2::set_pcjr(bool pcjr) {
@@ -965,11 +961,11 @@ void Player_V2::generatePCjrSamples(int16 *data, uint len) {
}
void Player_V2::mutex_up() {
- _system->lockMutex (_mutex);
+ _mutex.lock();
}
void Player_V2::mutex_down() {
- _system->unlockMutex (_mutex);
+ _mutex.unlock();
}
} // End of namespace Scumm
diff --git a/scumm/player_v2.h b/scumm/player_v2.h
index 7cc4c3e28a..045e8f1aa6 100644
--- a/scumm/player_v2.h
+++ b/scumm/player_v2.h
@@ -97,7 +97,6 @@ public:
protected:
bool _isV3Game;
SoundMixer *_mixer;
- OSystem *_system;
ScummEngine *_vm;
bool _pcjr;
@@ -133,7 +132,7 @@ private:
const uint16 *_freqs_table;
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
ChannelInfo _channels[5];
protected:
diff --git a/scumm/sound.cpp b/scumm/sound.cpp
index dc0b2cad65..de2a9a5080 100644
--- a/scumm/sound.cpp
+++ b/scumm/sound.cpp
@@ -29,7 +29,6 @@
#include "scumm/sound.h"
#include "common/config-manager.h"
-#include "common/system.h"
#include "common/timer.h"
#include "common/util.h"
@@ -2249,7 +2248,7 @@ int ScummEngine::readSoundResourceSmallHeader(int type, int idx) {
template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE>
class AppendableMemoryStream : public AppendableAudioStream {
protected:
- OSystem::MutexRef _mutex;
+ Common::Mutex _mutex;
byte *_bufferStart;
byte *_bufferEnd;
@@ -2287,14 +2286,11 @@ AppendableMemoryStream<stereo, is16Bit, isUnsigned, isLE>::AppendableMemoryStrea
_bufferStart = (byte *)malloc(bufferSize);
_pos = _end = _bufferStart;
_bufferEnd = _bufferStart + bufferSize;
-
- _mutex = g_system->createMutex();
}
template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE>
AppendableMemoryStream<stereo, is16Bit, isUnsigned, isLE>::~AppendableMemoryStream() {
free(_bufferStart);
- g_system->deleteMutex(_mutex);
}
template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE>
diff --git a/simon/midi.cpp b/simon/midi.cpp
index ccc9f8c22b..2031a68295 100644
--- a/simon/midi.cpp
+++ b/simon/midi.cpp
@@ -55,8 +55,6 @@ MidiPlayer::MidiPlayer(OSystem *system) {
// Since initialize() is called every time the music changes,
// this is where we'll initialize stuff that must persist
// between songs.
- _system = system;
- _mutex = system->createMutex();
_driver = 0;
_map_mt32_to_gm = false;
_passThrough = false;
@@ -75,10 +73,9 @@ MidiPlayer::MidiPlayer(OSystem *system) {
}
MidiPlayer::~MidiPlayer() {
- _system->lockMutex(_mutex);
+ _mutex.lock();
close();
- _system->unlockMutex(_mutex);
- _system->deleteMutex(_mutex);
+ _mutex.unlock();
}
int MidiPlayer::open() {
@@ -156,9 +153,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->unlockMutex(_mutex);
+ _mutex.unlock();
startTrack (destination);
- _system->lockMutex(_mutex);
+ _mutex.lock();
} else {
stop();
}
@@ -189,7 +186,7 @@ void MidiPlayer::startTrack (int track) {
if (track >= _music.num_songs)
return;
- _system->lockMutex(_mutex);
+ _mutex.lock();
if (_music.parser) {
_current = &_music;
@@ -211,9 +208,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->lockMutex(_mutex);
+ _mutex.lock();
if (!_music.parser->setTrack(track)) {
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
return;
}
_currentTrack = (byte) track;
@@ -222,7 +219,7 @@ void MidiPlayer::startTrack (int track) {
_current = 0;
}
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
}
void MidiPlayer::stop() {
@@ -292,15 +289,15 @@ void MidiPlayer::setLoop (bool loop) {
}
void MidiPlayer::queueTrack (int track, bool loop) {
- _system->lockMutex(_mutex);
+ _mutex.lock();
if (_currentTrack == 255) {
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
setLoop(loop);
startTrack(track);
} else {
_queuedTrack = track;
_loopQueuedTrack = loop;
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
}
}
diff --git a/simon/midi.h b/simon/midi.h
index ac53cbc021..828782690e 100644
--- a/simon/midi.h
+++ b/simon/midi.h
@@ -27,7 +27,6 @@
#include "common/mutex.h"
class File;
-class OSystem;
namespace Simon {
@@ -52,8 +51,7 @@ struct MusicInfo {
class MidiPlayer : public MidiDriver {
protected:
- OSystem *_system;
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
MidiDriver *_driver;
bool _map_mt32_to_gm;
bool _passThrough;
diff --git a/sky/music/adlibmusic.cpp b/sky/music/adlibmusic.cpp
index 0fb112efbe..6db9b83359 100644
--- a/sky/music/adlibmusic.cpp
+++ b/sky/music/adlibmusic.cpp
@@ -26,8 +26,8 @@
namespace Sky {
-AdlibMusic::AdlibMusic(SoundMixer *pMixer, Disk *pDisk, OSystem *system)
- : MusicBase(pDisk, system) {
+AdlibMusic::AdlibMusic(SoundMixer *pMixer, Disk *pDisk)
+ : MusicBase(pDisk) {
_driverFileBase = 60202;
_mixer = pMixer;
diff --git a/sky/music/adlibmusic.h b/sky/music/adlibmusic.h
index 86ab9a899c..b4be9b8cde 100644
--- a/sky/music/adlibmusic.h
+++ b/sky/music/adlibmusic.h
@@ -32,7 +32,7 @@ namespace Sky {
class AdlibMusic : public AudioStream, public MusicBase {
public:
- AdlibMusic(SoundMixer *pMixer, Disk *pDisk, OSystem *system);
+ AdlibMusic(SoundMixer *pMixer, Disk *pDisk);
~AdlibMusic(void);
virtual void setVolume(uint8 volume);
diff --git a/sky/music/gmmusic.cpp b/sky/music/gmmusic.cpp
index ba68ec2259..49f2796006 100644
--- a/sky/music/gmmusic.cpp
+++ b/sky/music/gmmusic.cpp
@@ -32,8 +32,8 @@ void GmMusic::passTimerFunc(void *param) {
((GmMusic*)param)->timerCall();
}
-GmMusic::GmMusic(MidiDriver *pMidiDrv, Disk *pDisk, OSystem *system)
- : MusicBase(pDisk, system) {
+GmMusic::GmMusic(MidiDriver *pMidiDrv, Disk *pDisk)
+ : MusicBase(pDisk) {
_driverFileBase = 60200;
_midiDrv = pMidiDrv;
diff --git a/sky/music/gmmusic.h b/sky/music/gmmusic.h
index b75c0f69a3..90e9ec68db 100644
--- a/sky/music/gmmusic.h
+++ b/sky/music/gmmusic.h
@@ -30,7 +30,7 @@ namespace Sky {
class GmMusic : public MusicBase {
public:
- GmMusic(MidiDriver *pMidiDrv, Disk *pDisk, OSystem *system);
+ GmMusic(MidiDriver *pMidiDrv, Disk *pDisk);
~GmMusic(void);
virtual void setVolume(uint8 volume);
private:
diff --git a/sky/music/mt32music.cpp b/sky/music/mt32music.cpp
index 6f941499d1..0b176fe44c 100644
--- a/sky/music/mt32music.cpp
+++ b/sky/music/mt32music.cpp
@@ -32,8 +32,8 @@ void MT32Music::passTimerFunc(void *param) {
((MT32Music*)param)->timerCall();
}
-MT32Music::MT32Music(MidiDriver *pMidiDrv, Disk *pDisk, OSystem *system)
- : MusicBase(pDisk, system) {
+MT32Music::MT32Music(MidiDriver *pMidiDrv, Disk *pDisk)
+ : MusicBase(pDisk) {
_driverFileBase = 60200;
_midiDrv = pMidiDrv;
diff --git a/sky/music/mt32music.h b/sky/music/mt32music.h
index fb2e131554..bf56f161da 100644
--- a/sky/music/mt32music.h
+++ b/sky/music/mt32music.h
@@ -30,7 +30,7 @@ namespace Sky {
class MT32Music : public MusicBase {
public:
- MT32Music(MidiDriver *pMidiDrv, Disk *pDisk, OSystem *system);
+ MT32Music(MidiDriver *pMidiDrv, Disk *pDisk);
~MT32Music(void);
private:
static void passTimerFunc(void *param);
diff --git a/sky/music/musicbase.cpp b/sky/music/musicbase.cpp
index 104b132103..29c2b73c19 100644
--- a/sky/music/musicbase.cpp
+++ b/sky/music/musicbase.cpp
@@ -22,20 +22,17 @@
#include "sky/music/musicbase.h"
#include "sky/disk.h"
#include "common/util.h"
-#include "common/system.h"
namespace Sky {
-MusicBase::MusicBase(Disk *pDisk, OSystem *system) {
+MusicBase::MusicBase(Disk *pDisk) {
_musicData = NULL;
_allowedCommands = 0;
_skyDisk = pDisk;
_currentMusic = 0;
_musicVolume = 127;
- _system = system;
_numberOfChannels = _currentMusic = 0;
- _mutex = _system->createMutex();
}
MusicBase::~MusicBase(void) {
@@ -46,7 +43,7 @@ MusicBase::~MusicBase(void) {
void MusicBase::loadSection(uint8 pSection) {
- _system->lockMutex(_mutex);
+ _mutex.lock();
if (_currentMusic)
stopMusic();
if (_musicData)
@@ -63,7 +60,7 @@ void MusicBase::loadSection(uint8 pSection) {
_numberOfChannels = _currentMusic = 0;
setupPointers();
startDriver();
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
}
bool MusicBase::musicIsPlaying(void) {
@@ -166,7 +163,7 @@ void MusicBase::loadNewMusic(void) {
void MusicBase::pollMusic(void) {
- _system->lockMutex(_mutex);
+ _mutex.lock();
uint8 newTempo;
if (_onNextPoll.doReInit) startDriver();
if (_onNextPoll.doStopMusic) stopMusic();
@@ -182,7 +179,7 @@ void MusicBase::pollMusic(void) {
updateTempo();
}
}
- _system->unlockMutex(_mutex);
+ _mutex.unlock();
_aktTime &= 0xFFFF;
}
diff --git a/sky/music/musicbase.h b/sky/music/musicbase.h
index f3e88dc1f2..f44c828d83 100644
--- a/sky/music/musicbase.h
+++ b/sky/music/musicbase.h
@@ -26,8 +26,6 @@
#include "common/scummsys.h"
#include "common/mutex.h"
-class OSystem;
-
namespace Sky {
class Disk;
@@ -50,7 +48,7 @@ private:
class MusicBase {
public:
- MusicBase(Disk *pDisk, OSystem *system);
+ MusicBase(Disk *pDisk);
virtual ~MusicBase(void);
void loadSection(uint8 pSection);
void musicCommand(uint16 command);
@@ -62,7 +60,6 @@ public:
protected:
- OSystem *_system;
Disk *_skyDisk;
uint8 *_musicData;
uint8 _allowedCommands;
@@ -77,7 +74,7 @@ protected:
uint32 _aktTime;
Actions _onNextPoll;
ChannelBase *_channels[10];
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
virtual void setupPointers(void) = 0;
virtual void setupChannels(uint8 *channelData) = 0;
diff --git a/sky/sky.cpp b/sky/sky.cpp
index 5e398dd812..28021847c2 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -252,13 +252,13 @@ int SkyEngine::init(GameDetector &detector) {
int midiDriver = MidiDriver::detectMusicDriver(MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE);
if (midiDriver == MD_ADLIB) {
_systemVars.systemFlags |= SF_SBLASTER;
- _skyMusic = new AdlibMusic(_mixer, _skyDisk, _system);
+ _skyMusic = new AdlibMusic(_mixer, _skyDisk);
} else {
_systemVars.systemFlags |= SF_ROLAND;
if (ConfMan.getBool("native_mt32") || (midiDriver == MD_MT32))
- _skyMusic = new MT32Music(MidiDriver::createMidi(midiDriver), _skyDisk, _system);
+ _skyMusic = new MT32Music(MidiDriver::createMidi(midiDriver), _skyDisk);
else
- _skyMusic = new GmMusic(MidiDriver::createMidi(midiDriver), _skyDisk, _system);
+ _skyMusic = new GmMusic(MidiDriver::createMidi(midiDriver), _skyDisk);
}
if (isCDVersion()) {
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 050f37f8ec..6eb5ea3b33 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -102,7 +102,6 @@ public:
SoundMixer::SoundMixer() {
_syst = &OSystem::instance();
- _mutex = _syst->createMutex();
_premixChannel = 0;
int i = 0;
@@ -130,8 +129,6 @@ SoundMixer::~SoundMixer() {
delete _premixChannel;
_premixChannel = 0;
-
- _syst->deleteMutex(_mutex);
}
bool SoundMixer::isPaused() {
diff --git a/sound/mixer.h b/sound/mixer.h
index 44f552fd9c..b042ae13fb 100644
--- a/sound/mixer.h
+++ b/sound/mixer.h
@@ -89,7 +89,7 @@ private:
};
OSystem *_syst;
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
Channel *_premixChannel;
diff --git a/sound/softsynth/mt32.cpp b/sound/softsynth/mt32.cpp
index 44221b91b1..61c4e9ff04 100644
--- a/sound/softsynth/mt32.cpp
+++ b/sound/softsynth/mt32.cpp
@@ -378,7 +378,7 @@ public:
class MidiDriver_ThreadedMT32 : public MidiDriver_MT32 {
private:
- OSystem::MutexRef _eventMutex;
+ OSystem::Mutex _eventMutex;
MidiEvent_MT32 *_events;
Timer::TimerProc _timer_proc;
@@ -391,7 +391,6 @@ protected:
public:
MidiDriver_ThreadedMT32(SoundMixer *mixer);
- virtual ~MidiDriver_ThreadedMT32();
void onTimer();
void close();
@@ -400,15 +399,10 @@ public:
MidiDriver_ThreadedMT32::MidiDriver_ThreadedMT32(SoundMixer *mixer) : MidiDriver_MT32(mixer) {
- _eventMutex = g_system->createMutex();
_events = NULL;
_timer_proc = NULL;
}
-MidiDriver_ThreadedMT32::~MidiDriver_ThreadedMT32() {
- g_system->deleteMutex(_eventMutex);
-}
-
void MidiDriver_ThreadedMT32::close() {
MidiDriver_MT32::close();
while ((popMidiEvent() != NULL)) {
@@ -427,7 +421,7 @@ void MidiDriver_ThreadedMT32::setTimerCallback(void *timer_param, Timer::TimerPr
}
void MidiDriver_ThreadedMT32::pushMidiEvent(MidiEvent_MT32 *event) {
- g_system->lockMutex(_eventMutex);
+ Common::StackLock lock(_eventMutex);
if (_events == NULL) {
_events = event;
} else {
@@ -436,16 +430,14 @@ void MidiDriver_ThreadedMT32::pushMidiEvent(MidiEvent_MT32 *event) {
last = last->_next;
last->_next = event;
}
- g_system->unlockMutex(_eventMutex);
}
MidiEvent_MT32 *MidiDriver_ThreadedMT32::popMidiEvent() {
+ Common::StackLock lock(_eventMutex);
MidiEvent_MT32 *event;
- g_system->lockMutex(_eventMutex);
event = _events;
if (event != NULL)
_events = event->_next;
- g_system->unlockMutex(_eventMutex);
return event;
}
diff --git a/sword1/music.cpp b/sword1/music.cpp
index 99166ed2e6..34ef5b48c9 100644
--- a/sword1/music.cpp
+++ b/sword1/music.cpp
@@ -251,11 +251,9 @@ void MusicHandle::stop() {
_looping = false;
}
-Music::Music(OSystem *system, SoundMixer *pMixer) {
- _system = system;
+Music::Music(SoundMixer *pMixer) {
_mixer = pMixer;
_sampleRate = pMixer->getOutputRate();
- _mutex = _system->createMutex();
_converter[0] = NULL;
_converter[1] = NULL;
_volumeL = _volumeR = 192;
@@ -266,8 +264,6 @@ Music::~Music() {
_mixer->setupPremix(0);
delete _converter[0];
delete _converter[1];
- if (_mutex)
- _system->deleteMutex(_mutex);
}
void Music::mixer(int16 *buf, uint32 len) {
diff --git a/sword1/music.h b/sword1/music.h
index 1a898e80f3..1920edd0f1 100644
--- a/sword1/music.h
+++ b/sword1/music.h
@@ -84,7 +84,7 @@ public:
class Music : public AudioStream {
public:
- Music(OSystem *system, SoundMixer *pMixer);
+ Music(SoundMixer *pMixer);
~Music();
void startMusic(int32 tuneId, int32 loopFlag);
void fadeDown();
@@ -104,10 +104,9 @@ private:
st_volume_t _volumeL, _volumeR;
MusicHandle _handles[2];
RateConverter *_converter[2];
- OSystem *_system;
SoundMixer *_mixer;
uint32 _sampleRate;
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
static void passMixerFunc(void *param, int16 *buf, uint len);
void mixer(int16 *buf, uint32 len);
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index 4e4eca1d37..6be538516e 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -170,7 +170,7 @@ int SwordEngine::init(GameDetector &detector) {
_mixer->setVolumeForSoundType(SoundMixer::kMusicAudioDataType, SoundMixer::kMaxMixerVolume);
_mouse = new Mouse(_system, _resMan, _objectMan);
_screen = new Screen(_system, _resMan, _objectMan);
- _music = new Music(_system, _mixer);
+ _music = new Music(_mixer);
_sound = new Sound("", _mixer, _resMan);
_menu = new Menu(_screen, _mouse);
_logic = new Logic(_objectMan, _resMan, _screen, _mouse, _sound, _music, _menu, _system, _mixer);
diff --git a/sword2/sound.cpp b/sword2/sound.cpp
index b50735ccc2..a9e21373c5 100644
--- a/sword2/sound.cpp
+++ b/sword2/sound.cpp
@@ -46,7 +46,6 @@ Sound::Sound(Sword2Engine *vm) {
int i;
_vm = vm;
- _mutex = _vm->_system->createMutex();
for (i = 0; i < FXQ_LENGTH; i++)
_fxQueue[i].resource = 0;
@@ -79,9 +78,6 @@ Sound::~Sound() {
delete _music[i];
free(_mixBuffer);
-
- if (_mutex)
- _vm->_system->deleteMutex(_mutex);
}
/**
diff --git a/sword2/sound.h b/sword2/sound.h
index d37ebeb450..9eeda246b5 100644
--- a/sword2/sound.h
+++ b/sword2/sound.h
@@ -62,8 +62,6 @@ enum {
FX_LOOPING = 4
};
-extern void sword2_sound_handler(void *refCon);
-
class CLUInputStream : public AudioStream {
private:
File *_file;
@@ -142,7 +140,7 @@ class Sound : public AudioStream {
private:
Sword2Engine *_vm;
- Common::MutexRef _mutex;
+ Common::Mutex _mutex;
struct FxQueueEntry {
PlayingSoundHandle handle; // sound handle