aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2005-01-28 22:05:51 +0000
committerMax Horn2005-01-28 22:05:51 +0000
commitabd12dd1b63d9e680bdc157fd5aa1fdb579e111e (patch)
treeda026a16edefcc56119ef2376eb0b26f7ec9d500 /sound
parentc62d82450b7fc4d64bf6102cb8074457e3d0cb47 (diff)
downloadscummvm-rg350-abd12dd1b63d9e680bdc157fd5aa1fdb579e111e.tar.gz
scummvm-rg350-abd12dd1b63d9e680bdc157fd5aa1fdb579e111e.tar.bz2
scummvm-rg350-abd12dd1b63d9e680bdc157fd5aa1fdb579e111e.zip
Use class Mutex instead of MutexRef
svn-id: r16679
Diffstat (limited to 'sound')
-rw-r--r--sound/mixer.cpp3
-rw-r--r--sound/mixer.h2
-rw-r--r--sound/softsynth/mt32.cpp14
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;
}