diff options
| author | Filippos Karapetis | 2009-01-06 12:33:59 +0000 | 
|---|---|---|
| committer | Filippos Karapetis | 2009-01-06 12:33:59 +0000 | 
| commit | de7721c63863018dc70aa5b7cf135d373c45892a (patch) | |
| tree | de020ddc91751d24a27febc99abb7f54a4c764c3 | |
| parent | e2463f77cdc4a11038843668988b388d03f06477 (diff) | |
| download | scummvm-rg350-de7721c63863018dc70aa5b7cf135d373c45892a.tar.gz scummvm-rg350-de7721c63863018dc70aa5b7cf135d373c45892a.tar.bz2 scummvm-rg350-de7721c63863018dc70aa5b7cf135d373c45892a.zip | |
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
svn-id: r35752
| -rw-r--r-- | engines/made/scriptfuncs.cpp | 9 | ||||
| -rw-r--r-- | engines/made/sound.cpp | 11 | ||||
| -rw-r--r-- | engines/made/sound.h | 3 | 
3 files changed, 16 insertions, 7 deletions
| diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp index e102a15487..ce084bfc7d 100644 --- a/engines/made/scriptfuncs.cpp +++ b/engines/made/scriptfuncs.cpp @@ -237,6 +237,7 @@ int16 ScriptFunctions::sfPlaySound(int16 argc, int16 *argv) {  		_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 ScriptFunctions::sfPlayVoice(int16 argc, int16 *argv) {  	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::sfClearMono(int16 argc, int16 *argv) {  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) { diff --git a/engines/made/sound.cpp b/engines/made/sound.cpp index a88274f205..e397bd584f 100644 --- a/engines/made/sound.cpp +++ b/engines/made/sound.cpp @@ -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 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou  		case 0:  			memset(soundBuffer, 0x80, workChunkSize); -			workSample = 0; -			soundEnergy = 0; +			workSample = 0;			 +			soundEnergy.push_back(0);  			break;  		case 1: @@ -96,14 +97,14 @@ void decompressSound(byte *source, byte *dest, uint16 chunkSize, uint16 chunkCou  				}  			} -			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: diff --git a/engines/made/sound.h b/engines/made/sound.h index bca4987d20..195c566066 100644 --- a/engines/made/sound.h +++ b/engines/made/sound.h @@ -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); | 
