[Scummvm-cvs-logs] SF.net SVN: scummvm:[45392] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Mon Oct 26 10:03:57 CET 2009


Revision: 45392
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45392&view=rev
Author:   spalek
Date:     2009-10-26 09:03:54 +0000 (Mon, 26 Oct 2009)

Log Message:
-----------
Fix 2 MIDI bugs

Modified Paths:
--------------
    scummvm/trunk/engines/draci/draci.cpp
    scummvm/trunk/engines/draci/music.cpp
    scummvm/trunk/engines/draci/music.h

Modified: scummvm/trunk/engines/draci/draci.cpp
===================================================================
--- scummvm/trunk/engines/draci/draci.cpp	2009-10-26 06:20:13 UTC (rev 45391)
+++ scummvm/trunk/engines/draci/draci.cpp	2009-10-26 09:03:54 UTC (rev 45392)
@@ -265,14 +265,13 @@
 				_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;

Modified: scummvm/trunk/engines/draci/music.cpp
===================================================================
--- scummvm/trunk/engines/draci/music.cpp	2009-10-26 06:20:13 UTC (rev 45391)
+++ scummvm/trunk/engines/draci/music.cpp	2009-10-26 09:03:54 UTC (rev 45392)
@@ -58,22 +58,24 @@
 	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) {
+	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 @@
 			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 @@
 	MusicPlayer *music = (MusicPlayer *)refCon;
 	Common::StackLock lock(music->_mutex);
 
-	if (music->_isPlaying)
+	if (music->_parser)
 		music->_parser->onTimer();
 }
 

Modified: scummvm/trunk/engines/draci/music.h
===================================================================
--- scummvm/trunk/engines/draci/music.h	2009-10-26 06:20:13 UTC (rev 45391)
+++ scummvm/trunk/engines/draci/music.h	2009-10-26 09:03:54 UTC (rev 45392)
@@ -79,6 +79,7 @@
 protected:
 
 	static void onTimer(void *data);
+	void setChannelVolume(int channel);
 
 	MidiChannel *_channel[16];
 	MidiDriver *_driver;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list