aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorRobert Špalek2009-10-26 09:03:54 +0000
committerRobert Špalek2009-10-26 09:03:54 +0000
commit7bec12bbec0190890425d173e48339c9de3813a5 (patch)
treea7624a9d7e4f3b655cca99a75451e392c01c367a /engines
parent994408a770a50cf698eb98e67b7b54d41b9b6a88 (diff)
downloadscummvm-rg350-7bec12bbec0190890425d173e48339c9de3813a5.tar.gz
scummvm-rg350-7bec12bbec0190890425d173e48339c9de3813a5.tar.bz2
scummvm-rg350-7bec12bbec0190890425d173e48339c9de3813a5.zip
Fix 2 MIDI bugs
svn-id: r45392
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/draci.cpp9
-rw-r--r--engines/draci/music.cpp24
-rw-r--r--engines/draci/music.h1
3 files changed, 19 insertions, 15 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index e32a239f94..f472592684 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -265,14 +265,13 @@ void DraciEngine::handleEvents() {
_showWalkingMap = !_showWalkingMap;
break;
case Common::KEYCODE_i:
- if (_game->getRoomNum() == _game->getMapRoom()) {
+ if (_game->getRoomNum() == _game->getMapRoom() ||
+ _game->getLoopSubstatus() != kSubstatusOrdinary) {
break;
}
- if (_game->getLoopStatus() == kStatusInventory &&
- _game->getLoopSubstatus() == kSubstatusOrdinary) {
+ if (_game->getLoopStatus() == kStatusInventory) {
_game->inventoryDone();
- } else if (_game->getLoopStatus() == kStatusOrdinary &&
- _game->getLoopSubstatus() == kSubstatusOrdinary) {
+ } else if (_game->getLoopStatus() == kStatusOrdinary) {
_game->inventoryInit();
}
break;
diff --git a/engines/draci/music.cpp b/engines/draci/music.cpp
index ec6d85c66c..7917ad7304 100644
--- a/engines/draci/music.cpp
+++ b/engines/draci/music.cpp
@@ -58,22 +58,24 @@ MusicPlayer::~MusicPlayer() {
delete _midiMusicData;
}
+void MusicPlayer::setChannelVolume(int channel) {
+ int newVolume = _channelVolume[channel] * _masterVolume / 255;
+ debugC(3, kDraciSoundDebugLevel, "Music channel %d: volume %d->%d",
+ channel, _channelVolume[channel], newVolume);
+ _channel[channel]->volume(newVolume);
+}
+
void MusicPlayer::setVolume(int volume) {
- volume = CLIP(volume, 0, 255);
+ Common::StackLock lock(_mutex);
+ volume = CLIP(volume, 0, 255);
if (_masterVolume == volume)
return;
-
_masterVolume = volume;
- Common::StackLock lock(_mutex);
-
for (int i = 0; i < 16; ++i) {
if (_channel[i]) {
- int newVolume = _channelVolume[i] * _masterVolume / 255;
- debugC(3, kDraciSoundDebugLevel, "Music channel %d: volume %d->%d",
- i, _channelVolume[i], newVolume);
- _channel[i]->volume(newVolume);
+ setChannelVolume(i);
}
}
}
@@ -121,8 +123,10 @@ void MusicPlayer::send(uint32 b) {
return;
}
- if (!_channel[channel])
+ if (!_channel[channel]) {
_channel[channel] = (channel == 9) ? _driver->getPercussionChannel() : _driver->allocateChannel();
+ setChannelVolume(channel);
+ }
if (_channel[channel])
_channel[channel]->send(b);
@@ -147,7 +151,7 @@ void MusicPlayer::onTimer(void *refCon) {
MusicPlayer *music = (MusicPlayer *)refCon;
Common::StackLock lock(music->_mutex);
- if (music->_isPlaying)
+ if (music->_parser)
music->_parser->onTimer();
}
diff --git a/engines/draci/music.h b/engines/draci/music.h
index d56de17866..82e85208ac 100644
--- a/engines/draci/music.h
+++ b/engines/draci/music.h
@@ -79,6 +79,7 @@ public:
protected:
static void onTimer(void *data);
+ void setChannelVolume(int channel);
MidiChannel *_channel[16];
MidiDriver *_driver;