diff options
author | Max Horn | 2011-03-23 11:47:07 +0100 |
---|---|---|
committer | Max Horn | 2011-03-23 15:25:46 +0100 |
commit | 7b02dac3c5678bb47216495fc97130b98ff2bfe4 (patch) | |
tree | ebeba91f309e1321b4a72136d59672b696eb7849 /engines/touche | |
parent | 99dbecf3b4a14382fa867610a43201fc150bfda9 (diff) | |
download | scummvm-rg350-7b02dac3c5678bb47216495fc97130b98ff2bfe4.tar.gz scummvm-rg350-7b02dac3c5678bb47216495fc97130b98ff2bfe4.tar.bz2 scummvm-rg350-7b02dac3c5678bb47216495fc97130b98ff2bfe4.zip |
ENGINES: Use Common::StackLock in more places
Diffstat (limited to 'engines/touche')
-rw-r--r-- | engines/touche/midi.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/engines/touche/midi.cpp b/engines/touche/midi.cpp index c420fb34ff..c1270dd2e2 100644 --- a/engines/touche/midi.cpp +++ b/engines/touche/midi.cpp @@ -48,32 +48,30 @@ void MidiPlayer::play(Common::ReadStream &stream, int size, bool loop) { _midiData = (uint8 *)malloc(size); if (_midiData) { stream.read(_midiData, size); - _mutex.lock(); + + Common::StackLock lock(_mutex); _parser->loadMusic(_midiData, size); _parser->setTrack(0); _isLooping = loop; _isPlaying = true; - _mutex.unlock(); } } void MidiPlayer::stop() { - _mutex.lock(); + Common::StackLock lock(_mutex); if (_isPlaying) { _isPlaying = false; _parser->unloadMusic(); free(_midiData); _midiData = 0; } - _mutex.unlock(); } void MidiPlayer::updateTimer() { - _mutex.lock(); + Common::StackLock lock(_mutex); if (_isPlaying) { _parser->onTimer(); } - _mutex.unlock(); } void MidiPlayer::adjustVolume(int diff) { @@ -82,13 +80,12 @@ void MidiPlayer::adjustVolume(int diff) { void MidiPlayer::setVolume(int volume) { _masterVolume = CLIP(volume, 0, 255); - _mutex.lock(); + Common::StackLock lock(_mutex); for (int i = 0; i < NUM_CHANNELS; ++i) { if (_channelsTable[i]) { _channelsTable[i]->volume(_channelsVolume[i] * _masterVolume / 255); } } - _mutex.unlock(); } int MidiPlayer::open() { @@ -116,14 +113,14 @@ bool MidiPlayer::isOpen() const { void MidiPlayer::close() { stop(); - _mutex.lock(); + + Common::StackLock lock(_mutex); _driver->setTimerCallback(NULL, NULL); _driver->close(); delete _driver; _driver = 0; _parser->setMidiDriver(NULL); delete _parser; - _mutex.unlock(); } void MidiPlayer::send(uint32 b) { |