aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sfx/core.cpp
diff options
context:
space:
mode:
authorMax Horn2009-11-26 16:11:45 +0000
committerMax Horn2009-11-26 16:11:45 +0000
commit4e153c2f9ef041a547c72b148722c088e593e2aa (patch)
tree926700a8c2655ac37d88f0a3290c31575d423534 /engines/sci/sfx/core.cpp
parente98f789a02024c80f9e4275980587f962275cc13 (diff)
downloadscummvm-rg350-4e153c2f9ef041a547c72b148722c088e593e2aa.tar.gz
scummvm-rg350-4e153c2f9ef041a547c72b148722c088e593e2aa.tar.bz2
scummvm-rg350-4e153c2f9ef041a547c72b148722c088e593e2aa.zip
SCI: Turn SfxPlayer::_mutex from a pointer into a plain member
svn-id: r46157
Diffstat (limited to 'engines/sci/sfx/core.cpp')
-rw-r--r--engines/sci/sfx/core.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/engines/sci/sfx/core.cpp b/engines/sci/sfx/core.cpp
index 84c1da51b0..b3bd7bac2a 100644
--- a/engines/sci/sfx/core.cpp
+++ b/engines/sci/sfx/core.cpp
@@ -68,7 +68,7 @@ protected:
bool _iteratorIsDone;
uint32 _tempo;
- Common::Mutex *_mutex;
+ Common::Mutex _mutex;
int _volume;
void play_song(SongIterator *it);
@@ -148,7 +148,6 @@ SfxPlayer::SfxPlayer() {
_iteratorIsDone = false;
_tempo = 0;
- _mutex = 0;
_volume = 15;
}
@@ -157,7 +156,6 @@ SfxPlayer::~SfxPlayer() {
_mididrv->close();
delete _mididrv;
}
- delete _mutex;
delete _iterator;
_iterator = NULL;
}
@@ -211,7 +209,7 @@ void SfxPlayer::tell_synth(int buf_nr, byte *buf) {
void SfxPlayer::player_timer_callback(void *refCon) {
SfxPlayer *thePlayer = (SfxPlayer *)refCon;
assert(refCon);
- Common::StackLock lock(*thePlayer->_mutex);
+ Common::StackLock lock(thePlayer->_mutex);
if (thePlayer->_iterator && !thePlayer->_iteratorIsDone && !thePlayer->_paused) {
thePlayer->play_song(thePlayer->_iterator);
@@ -252,8 +250,6 @@ Common::Error SfxPlayer::init(ResourceManager *resMan, int expected_latency) {
_currentTime = Audio::Timestamp(time, 1000000 / _tempo);
_wakeupTime = Audio::Timestamp(time, SFX_TICKS_PER_SEC);
- _mutex = new Common::Mutex();
-
_mididrv->setTimerCallback(this, player_timer_callback);
_mididrv->open(resMan);
_mididrv->setVolume(_volume);
@@ -262,7 +258,7 @@ Common::Error SfxPlayer::init(ResourceManager *resMan, int expected_latency) {
}
Common::Error SfxPlayer::add_iterator(SongIterator *it, uint32 start_time) {
- Common::StackLock lock(*_mutex);
+ Common::StackLock lock(_mutex);
SIMSG_SEND(it, SIMSG_SET_PLAYMASK(_mididrv->getPlayMask()));
SIMSG_SEND(it, SIMSG_SET_RHYTHM(_mididrv->hasRhythmChannel()));
@@ -280,7 +276,7 @@ Common::Error SfxPlayer::add_iterator(SongIterator *it, uint32 start_time) {
Common::Error SfxPlayer::stop() {
debug(3, "Player: Stopping song iterator %p", (void *)_iterator);
- Common::StackLock lock(*_mutex);
+ Common::StackLock lock(_mutex);
delete _iterator;
_iterator = NULL;
for (int i = 0; i < MIDI_CHANNELS; i++)
@@ -290,7 +286,7 @@ Common::Error SfxPlayer::stop() {
}
Common::Error SfxPlayer::iterator_message(const SongIterator::Message &msg) {
- Common::StackLock lock(*_mutex);
+ Common::StackLock lock(_mutex);
if (!_iterator) {
return Common::kUnknownError;
}
@@ -301,7 +297,7 @@ Common::Error SfxPlayer::iterator_message(const SongIterator::Message &msg) {
}
Common::Error SfxPlayer::pause() {
- Common::StackLock lock(*_mutex);
+ Common::StackLock lock(_mutex);
_paused = true;
_pauseTimeDiff = _wakeupTime.msecsDiff(_currentTime);
@@ -312,7 +308,7 @@ Common::Error SfxPlayer::pause() {
}
Common::Error SfxPlayer::resume() {
- Common::StackLock lock(*_mutex);
+ Common::StackLock lock(_mutex);
_wakeupTime = Audio::Timestamp(_currentTime.msecs() + _pauseTimeDiff, SFX_TICKS_PER_SEC);
_mididrv->playSwitch(true);