[Scummvm-cvs-logs] SF.net SVN: scummvm:[54461] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Nov 24 17:01:31 CET 2010


Revision: 54461
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54461&view=rev
Author:   thebluegr
Date:     2010-11-24 16:01:30 +0000 (Wed, 24 Nov 2010)

Log Message:
-----------
SCI: Some renaming and added several TODOs concerning reverb

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/savegame.cpp
    scummvm/trunk/engines/sci/sound/drivers/mididriver.h
    scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
    scummvm/trunk/engines/sci/sound/music.cpp
    scummvm/trunk/engines/sci/sound/music.h
    scummvm/trunk/engines/sci/sound/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/engine/savegame.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/savegame.cpp	2010-11-24 15:12:43 UTC (rev 54460)
+++ scummvm/trunk/engines/sci/engine/savegame.cpp	2010-11-24 16:01:30 UTC (rev 54461)
@@ -557,7 +557,7 @@
 
 		soundSetSoundOn(_soundOn);
 		soundSetMasterVolume(masterVolume);
-		setReverb(reverb);
+		setGlobalReverb(reverb);
 	}
 
 	if (s.isSaving())

Modified: scummvm/trunk/engines/sci/sound/drivers/mididriver.h
===================================================================
--- scummvm/trunk/engines/sci/sound/drivers/mididriver.h	2010-11-24 15:12:43 UTC (rev 54460)
+++ scummvm/trunk/engines/sci/sound/drivers/mididriver.h	2010-11-24 16:01:30 UTC (rev 54461)
@@ -111,7 +111,9 @@
 		return _driver ? _driver->property(MIDI_PROP_MASTER_VOLUME, 0xffff) : 0;
 	}
 
+	// Returns the current reverb
 	byte getReverb() const { return _reverb; }
+	// Sets the current reverb, used mainly in MT-32
 	virtual void setReverb(byte reverb) { _reverb = reverb; }
 
 	virtual void playSwitch(bool play) {

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-11-24 15:12:43 UTC (rev 54460)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-11-24 16:01:30 UTC (rev 54461)
@@ -501,6 +501,8 @@
 			// Also, sci/sound/iterator/iterator.cpp, function BaseSongIterator::parseMidiCommand()
 			switch (info.basic.param1) {
 			case kSetReverb:
+				// TODO: This should be the song's reverb, and we need to check it against
+				// the global one
 				if (info.basic.param2 != 127)	// 127: SCI invalid, ignore
 					((MidiPlayer *)_driver)->setReverb(info.basic.param2);
 				break;

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-11-24 15:12:43 UTC (rev 54460)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-11-24 16:01:30 UTC (rev 54461)
@@ -225,17 +225,19 @@
 	return highestPrioritySlot;
 }
 
-void SciMusic::setReverb(byte reverb) {
+void SciMusic::setGlobalReverb(byte reverb) {
 	Common::StackLock lock(_mutex);
-	if (reverb != 127)	// 127: SCI invalid, ignore
+	if (reverb != 127) {
+		// Set global reverb normally
+		// TODO: Set global music reverb
+		// TODO: Only set reverb when the reverb of the active song is 127
 		_pMidiDrv->setReverb(reverb);
-
-	// SSCI stored a separate reverb value per song
-	// We don't, currently, as the current functionality
-	// works without an additional variable
+	} else {
+		// TODO: Set reverb of the active song
+	}
 }
 
-byte SciMusic::getReverb() {
+byte SciMusic::getCurrentReverb() {
 	Common::StackLock lock(_mutex);
 	return _pMidiDrv->getReverb();
 }
@@ -666,6 +668,7 @@
 	loop = 0;
 	volume = MUSIC_VOLUME_DEFAULT;
 	hold = -1;
+	reverb = -1;
 
 	pauseCounter = 0;
 	sampleLoopCounter = 0;

Modified: scummvm/trunk/engines/sci/sound/music.h
===================================================================
--- scummvm/trunk/engines/sci/sound/music.h	2010-11-24 15:12:43 UTC (rev 54460)
+++ scummvm/trunk/engines/sci/sound/music.h	2010-11-24 16:01:30 UTC (rev 54461)
@@ -76,6 +76,7 @@
 	uint16 loop;
 	int16 volume;
 	int16 hold;
+	int16 reverb;
 
 	int16 pauseCounter;
 	uint sampleLoopCounter;
@@ -187,8 +188,8 @@
 	void sendMidiCommand(uint32 cmd);
 	void sendMidiCommand(MusicEntry *pSnd, uint32 cmd);
 
-	void setReverb(byte reverb);
-	byte getReverb();
+	void setGlobalReverb(byte reverb);
+	byte getCurrentReverb();
 
 	virtual void saveLoadWithSerializer(Common::Serializer &ser);
 

Modified: scummvm/trunk/engines/sci/sound/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-11-24 15:12:43 UTC (rev 54460)
+++ scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-11-24 16:01:30 UTC (rev 54461)
@@ -492,21 +492,16 @@
 }
 
 reg_t SoundCommandParser::kDoSoundGlobalReverb(int argc, reg_t *argv, reg_t acc) {
-	if (argc == 0)
-		return make_reg(0, _music->getReverb());
+	byte prevReverb = _music->getCurrentReverb();
+	byte reverb = argv[0].toUint16() & 0xF;
 
-	debugC(2, kDebugLevelSound, "doSoundGlobalReverb: %d", argv[0].toUint16() & 0xF);
+	if (argc == 1) {
+		debugC(2, kDebugLevelSound, "doSoundGlobalReverb: %d", argv[0].toUint16() & 0xF);
+		if (reverb <= 10)
+			_music->setGlobalReverb(reverb);
+	}
 
-	// This is a bit different than SSCI, but the end result should be the same.
-	// SSCI checks the first entry in the playlist for its current reverb value.
-	// If it's 127 (invalid), it sets the reverb parameter of this call to the
-	// driver, otherwise it doesn't, to preserve the song's reverb. When we modify
-	// the global reverb, we send its value to the soundcard, if it isn't 127 (invalid).
-	// This assumes that the currently set reverb in the driver will be the reverb
-	// value sent from the last song, which should be the one at the top of the list.
-	_music->setReverb(argv[0].toUint16() & 0xF);
-
-	return acc;
+	return make_reg(0, prevReverb);
 }
 
 reg_t SoundCommandParser::kDoSoundSetHold(int argc, reg_t *argv, reg_t acc) {


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