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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Nov 24 15:21:31 CET 2010


Revision: 54457
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54457&view=rev
Author:   thebluegr
Date:     2010-11-24 14:21:31 +0000 (Wed, 24 Nov 2010)

Log Message:
-----------
SCI: some changes to the way reverb is handled

- "Invalid" SCI reverb values (127) are properly handled now
- SCI kDoSound(reverb) sets the global reverb (renamed it accordingly)
- kDoSound(reverb) can also return the current reverb if no parameter is sent

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kernel.h
    scummvm/trunk/engines/sci/engine/kernel_tables.h
    scummvm/trunk/engines/sci/engine/ksound.cpp
    scummvm/trunk/engines/sci/sound/drivers/midi.cpp
    scummvm/trunk/engines/sci/sound/soundcmd.cpp
    scummvm/trunk/engines/sci/sound/soundcmd.h

Modified: scummvm/trunk/engines/sci/engine/kernel.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel.h	2010-11-24 14:15:46 UTC (rev 54456)
+++ scummvm/trunk/engines/sci/engine/kernel.h	2010-11-24 14:21:31 UTC (rev 54457)
@@ -488,7 +488,7 @@
 reg_t kDoSoundGetPolyphony(EngineState *s, int argc, reg_t *argv);
 reg_t kDoSoundUpdateCues(EngineState *s, int argc, reg_t *argv);
 reg_t kDoSoundSendMidi(EngineState *s, int argc, reg_t *argv);
-reg_t kDoSoundReverb(EngineState *s, int argc, reg_t *argv);
+reg_t kDoSoundGlobalReverb(EngineState *s, int argc, reg_t *argv);
 reg_t kDoSoundSetHold(EngineState *s, int argc, reg_t *argv);
 reg_t kDoSoundDummy(EngineState *s, int argc, reg_t *argv);
 reg_t kDoSoundGetAudioCapability(EngineState *s, int argc, reg_t *argv);

Modified: scummvm/trunk/engines/sci/engine/kernel_tables.h
===================================================================
--- scummvm/trunk/engines/sci/engine/kernel_tables.h	2010-11-24 14:15:46 UTC (rev 54456)
+++ scummvm/trunk/engines/sci/engine/kernel_tables.h	2010-11-24 14:21:31 UTC (rev 54457)
@@ -117,7 +117,7 @@
 	{ SIG_SOUNDSCI1EARLY, 10, MAP_CALL(DoSoundFade),               "oiiii",                kDoSoundFade_workarounds },
 	{ SIG_SOUNDSCI1EARLY, 11, MAP_CALL(DoSoundUpdateCues),         "o",                    NULL },
 	{ SIG_SOUNDSCI1EARLY, 12, MAP_CALL(DoSoundSendMidi),           "oiii",                 NULL },
-	{ SIG_SOUNDSCI1EARLY, 13, MAP_CALL(DoSoundReverb),             "i",                    NULL },
+	{ SIG_SOUNDSCI1EARLY, 13, MAP_CALL(DoSoundGlobalReverb),       "(i)",                  NULL },
 	{ SIG_SOUNDSCI1EARLY, 14, MAP_CALL(DoSoundSetHold),            "oi",                   NULL },
 	{ SIG_SOUNDSCI1EARLY, 15, MAP_CALL(DoSoundDummy),              "",                     NULL },
 	//  ^^ Longbow demo
@@ -140,12 +140,12 @@
 	{ SIG_SOUNDSCI1LATE,  16, MAP_CALL(DoSoundSetLoop),            "oi",                   NULL },
 	{ SIG_SOUNDSCI1LATE,  17, MAP_CALL(DoSoundUpdateCues),         NULL,                   NULL },
 	{ SIG_SOUNDSCI1LATE,  18, MAP_CALL(DoSoundSendMidi),           "oiii(i)",              NULL },
-	{ SIG_SOUNDSCI1LATE,  19, MAP_CALL(DoSoundReverb),             NULL,                   NULL },
+	{ SIG_SOUNDSCI1LATE,  19, MAP_CALL(DoSoundGlobalReverb),       NULL,                   NULL },
 	{ SIG_SOUNDSCI1LATE,  20, MAP_CALL(DoSoundUpdate),             NULL,                   NULL },
 #ifdef ENABLE_SCI32
 	{ SIG_SOUNDSCI21,      0, MAP_CALL(DoSoundMasterVolume),       NULL,                   NULL },
 	{ SIG_SOUNDSCI21,      1, MAP_CALL(DoSoundMute),               NULL,                   NULL },
-	{ SIG_SOUNDSCI21,      2, MAP_CALL(DoSoundRestore),           NULL,                   NULL },
+	{ SIG_SOUNDSCI21,      2, MAP_CALL(DoSoundRestore),            NULL,                   NULL },
 	{ SIG_SOUNDSCI21,      3, MAP_CALL(DoSoundGetPolyphony),       NULL,                   NULL },
 	{ SIG_SOUNDSCI21,      4, MAP_CALL(DoSoundGetAudioCapability), NULL,                   NULL },
 	{ SIG_SOUNDSCI21,      5, MAP_CALL(DoSoundSuspend),            NULL,                   NULL },
@@ -167,7 +167,7 @@
 	{ SIG_SOUNDSCI21,     16, MAP_CALL(DoSoundSetLoop),            NULL,                   NULL },
 	{ SIG_SOUNDSCI21,     17, MAP_CALL(DoSoundUpdateCues),         NULL,                   NULL },
 	{ SIG_SOUNDSCI21,     18, MAP_CALL(DoSoundSendMidi),           NULL,                   NULL },
-	{ SIG_SOUNDSCI21,     19, MAP_CALL(DoSoundReverb),             NULL,                   NULL },
+	{ SIG_SOUNDSCI21,     19, MAP_CALL(DoSoundGlobalReverb),       NULL,                   NULL },
 	{ SIG_SOUNDSCI21,     20, MAP_CALL(DoSoundUpdate),             NULL,                   NULL },
 #endif
 	SCI_SUBOPENTRY_TERMINATOR

Modified: scummvm/trunk/engines/sci/engine/ksound.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/ksound.cpp	2010-11-24 14:15:46 UTC (rev 54456)
+++ scummvm/trunk/engines/sci/engine/ksound.cpp	2010-11-24 14:21:31 UTC (rev 54457)
@@ -61,7 +61,7 @@
 CREATE_DOSOUND_FORWARD(DoSoundGetPolyphony)
 CREATE_DOSOUND_FORWARD(DoSoundUpdateCues)
 CREATE_DOSOUND_FORWARD(DoSoundSendMidi)
-CREATE_DOSOUND_FORWARD(DoSoundReverb)
+CREATE_DOSOUND_FORWARD(DoSoundGlobalReverb)
 CREATE_DOSOUND_FORWARD(DoSoundSetHold)
 CREATE_DOSOUND_FORWARD(DoSoundDummy)
 CREATE_DOSOUND_FORWARD(DoSoundGetAudioCapability)

Modified: scummvm/trunk/engines/sci/sound/drivers/midi.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/drivers/midi.cpp	2010-11-24 14:15:46 UTC (rev 54456)
+++ scummvm/trunk/engines/sci/sound/drivers/midi.cpp	2010-11-24 14:21:31 UTC (rev 54457)
@@ -378,8 +378,10 @@
 }
 
 void MidiPlayer_Midi::setReverb(byte reverb) {
-	_reverb = CLIP<byte>(reverb, 0, kReverbConfigNr - 1);
-	if (_hasReverb)
+	assert(reverb < kReverbConfigNr || reverb == 127);
+	_reverb = reverb;
+
+	if (_hasReverb && _reverb != 127)	// 127: SCI invalid, don't send to sound card
 		sendMt32SysEx(0x100001, _reverbConfig[_reverb], 3, true);
 }
 
@@ -469,8 +471,6 @@
 	setMt32Volume(volume);
 
 	// Reverb default only used in (roughly) SCI0/SCI01
-	// TODO: we need to send this to the MT-32, if it's available.
-	// Check patch #3117434
 	_reverb = str->readByte();
 	_hasReverb = true;
 
@@ -478,6 +478,8 @@
 	str->seek(11, SEEK_CUR);
 
 	// Read reverb data (stored vertically - patch #3117434)
+	// TODO: we need to send this to the MT-32, if it's available,
+	// depending on the SCI version
 	for (int j = 0; j < 3; ++j) {
 		for (int i = 0; i < kReverbConfigNr; i++) {
 			_reverbConfig[i][j] = str->readByte();

Modified: scummvm/trunk/engines/sci/sound/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-11-24 14:15:46 UTC (rev 54456)
+++ scummvm/trunk/engines/sci/sound/soundcmd.cpp	2010-11-24 14:21:31 UTC (rev 54457)
@@ -491,9 +491,21 @@
 	return acc;
 }
 
-reg_t SoundCommandParser::kDoSoundReverb(int argc, reg_t *argv, reg_t acc) {
-	debugC(2, kDebugLevelSound, "doSoundReverb: %d", argv[0].toUint16() & 0xF);
+reg_t SoundCommandParser::kDoSoundGlobalReverb(int argc, reg_t *argv, reg_t acc) {
+	if (argc == 0)
+		return make_reg(0, _music->getReverb());
+
+	debugC(2, kDebugLevelSound, "doSoundGlobalReverb: %d", argv[0].toUint16() & 0xF);
+
+	// 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;
 }
 

Modified: scummvm/trunk/engines/sci/sound/soundcmd.h
===================================================================
--- scummvm/trunk/engines/sci/sound/soundcmd.h	2010-11-24 14:15:46 UTC (rev 54456)
+++ scummvm/trunk/engines/sci/sound/soundcmd.h	2010-11-24 14:21:31 UTC (rev 54457)
@@ -94,7 +94,7 @@
 	reg_t kDoSoundUpdate(int argc, reg_t *argv, reg_t acc);
 	reg_t kDoSoundUpdateCues(int argc, reg_t *argv, reg_t acc);
 	reg_t kDoSoundSendMidi(int argc, reg_t *argv, reg_t acc);
-	reg_t kDoSoundReverb(int argc, reg_t *argv, reg_t acc);
+	reg_t kDoSoundGlobalReverb(int argc, reg_t *argv, reg_t acc);
 	reg_t kDoSoundSetHold(int argc, reg_t *argv, reg_t acc);
 	reg_t kDoSoundDummy(int argc, reg_t *argv, reg_t acc);
 	reg_t kDoSoundGetAudioCapability(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