[Scummvm-cvs-logs] SF.net SVN: scummvm:[35752] scummvm/trunk/engines/made

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Jan 6 13:33:59 CET 2009


Revision: 35752
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35752&view=rev
Author:   thebluegr
Date:     2009-01-06 12:33:59 +0000 (Tue, 06 Jan 2009)

Log Message:
-----------
Sound energy values are now stored in a list, to account for the fact that the original decompressed sounds on the fly, but we're decompressing them when the sound is being loaded

Modified Paths:
--------------
    scummvm/trunk/engines/made/scriptfuncs.cpp
    scummvm/trunk/engines/made/sound.cpp
    scummvm/trunk/engines/made/sound.h

Modified: scummvm/trunk/engines/made/scriptfuncs.cpp
===================================================================
--- scummvm/trunk/engines/made/scriptfuncs.cpp	2009-01-06 10:40:38 UTC (rev 35751)
+++ scummvm/trunk/engines/made/scriptfuncs.cpp	2009-01-06 12:33:59 UTC (rev 35752)
@@ -237,6 +237,7 @@
 		_vm->_autoStopSound = (argv[0] == 1);
 	}
 	if (soundNum > 0) {
+		soundEnergy.clear();
 		_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
 			_vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, false));
 	}
@@ -546,6 +547,7 @@
 	int16 soundNum = argv[0];
 	_vm->_mixer->stopHandle(_audioStreamHandle);
 	if (soundNum > 0) {
+		soundEnergy.clear();
 		_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
 			_vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, false));
 		_vm->_autoStopSound = true;
@@ -599,7 +601,12 @@
 int16 ScriptFunctions::sfGetSoundEnergy(int16 argc, int16 *argv) {
 	// This is called while in-game voices are played to animate 
 	// mouths when NPCs are talking
-	return soundEnergy;
+	int result = 0;
+	if (soundEnergy.size() > 0) {
+		result = *soundEnergy.begin();
+		soundEnergy.pop_front();
+	}
+	return result;
 }
 
 int16 ScriptFunctions::sfClearText(int16 argc, int16 *argv) {

Modified: scummvm/trunk/engines/made/sound.cpp
===================================================================
--- scummvm/trunk/engines/made/sound.cpp	2009-01-06 10:40:38 UTC (rev 35751)
+++ scummvm/trunk/engines/made/sound.cpp	2009-01-06 12:33:59 UTC (rev 35752)
@@ -24,13 +24,14 @@
  */
 
 #include "common/endian.h"
+#include "common/list.h"
 #include "common/util.h"
 
 #include "made/sound.h"
 
 namespace Made {
 
-int soundEnergy = 0;
+Common::List<int> soundEnergy;
 
 void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCount) {
 
@@ -68,8 +69,8 @@
 
 		case 0:
 			memset(soundBuffer, 0x80, workChunkSize);
-			workSample = 0;
-			soundEnergy = 0;
+			workSample = 0;			
+			soundEnergy.push_back(0);
 			break;
 
 		case 1:
@@ -96,14 +97,14 @@
 				}
 			}
 
-			soundEnergy = type - 1;
+			soundEnergy.push_back(type - 1);
 			break;
 
 		case 5:
 			for (i = 0; i < workChunkSize; i++)
 				soundBuffer[i] = *source++;
 			workSample = soundBuffer[workChunkSize - 1] - 128;
-			soundEnergy = 4;
+			soundEnergy.push_back(type - 1);
 			break;
 
 		default:

Modified: scummvm/trunk/engines/made/sound.h
===================================================================
--- scummvm/trunk/engines/made/sound.h	2009-01-06 10:40:38 UTC (rev 35751)
+++ scummvm/trunk/engines/made/sound.h	2009-01-06 12:33:59 UTC (rev 35752)
@@ -28,11 +28,12 @@
 
 #include "common/util.h"
 #include "common/file.h"
+#include "common/list.h"
 #include "common/stream.h"
 
 namespace Made {
 
-extern int soundEnergy;
+extern Common::List<int> soundEnergy;
 
 void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCount);
 


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