diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/mixer.cpp | 3 | ||||
-rw-r--r-- | sound/mixer.h | 2 | ||||
-rw-r--r-- | sound/softsynth/mt32.cpp | 14 |
3 files changed, 4 insertions, 15 deletions
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; } |