[Scummvm-cvs-logs] CVS: scummvm/scumm sound.cpp,1.452,1.453 sound.h,1.85,1.86 string.cpp,1.288,1.289

kirben kirben at users.sourceforge.net
Sun May 8 07:32:48 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25176/scumm

Modified Files:
	sound.cpp sound.h string.cpp 
Log Message:

HE games queue speech as sound resource 1.


Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.cpp,v
retrieving revision 1.452
retrieving revision 1.453
diff -u -d -r1.452 -r1.453
--- sound.cpp	1 May 2005 03:17:44 -0000	1.452
+++ sound.cpp	8 May 2005 14:31:25 -0000	1.453
@@ -648,10 +648,24 @@
 	return ((const MP3OffsetTable *)a)->org_offset - ((const MP3OffsetTable *)b)->org_offset;
 }
 
+void Sound::startHETalkSound(uint32 offset) {
+	byte *ptr;
+	int32 size;
+
+	_vm->res.nukeResource(rtSound, 1);
+	_sfxFile->seek(offset + 4, SEEK_SET);
+	 size = _sfxFile->readUint32BE() - 8;
+	_vm->res.createResource(rtSound, 1, size);
+	ptr = _vm->getResourceAddress(rtSound, 1);
+	_sfxFile->read(ptr, size);
+
+	int channel = (_vm->VAR_SOUND_CHANNEL != 0xFF) ? _vm->VAR(_vm->VAR_SOUND_CHANNEL) : 0;
+	addSoundToQueue2(1, 0, channel, 0);
+}
+
 void Sound::startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handle) {
 	int num = 0, i;
 	int size = 0;
-	byte *sound;
 	int id = -1;
 
 	if (_vm->_gameId == GID_CMI) {
@@ -704,46 +718,6 @@
 			return;
 		}
 
-		if (_vm->_heversion >= 60) {
-			_sfxMode |= mode;
-
-			_sfxFile->seek(offset, SEEK_SET);
-			if (_sfxFile->readUint32LE() == TO_LE_32(MKID('WSOU'))) {
-				// Skip the WSOU chunk
-				_sfxFile->seek(offset + 8, SEEK_SET);
-
-				// Try to load the WAVE data into an audio stream
-				AudioStream *stream = makeWAVStream(*_sfxFile);
-				if (!stream) {
-					warning("startTalkSound: IMA ADPCM compression not supported");
-					return;
-				}
-
-				int channel = _vm->VAR(_vm->VAR_SOUND_CHANNEL);
-				_vm->_mixer->playInputStream(SoundMixer::kSFXSoundType, &_heSoundChannels[channel], stream, 1);
-			} else {
-				// Skip the TALK (8) and HSHD (24) chunks
-				_sfxFile->seek(28, SEEK_CUR);
-
-				if (_sfxFile->readUint32LE() == TO_LE_32(MKID('SBNG'))) {
-					// Skip the SBNG, so we end up at the SDAT chunk
-					size = _sfxFile->readUint32BE() - 4;
-					_sfxFile->seek(size, SEEK_CUR);
-				}
-				size = _sfxFile->readUint32BE() - 8;
-				sound = (byte *)malloc(size);
-				_sfxFile->read(sound, size);
-
-				if (_vm->_heversion >= 70) {
-					int channel = _vm->VAR(_vm->VAR_SOUND_CHANNEL);
-					_vm->_mixer->playRaw(&_heSoundChannels[channel], sound, size, 11000, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE, 1);
-				} else {
-					_vm->_mixer->playRaw(handle, sound, size, 11000, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
-				}
-			}
-			return;
-		}
-
 		// Some games frequently assume that starting one sound effect will
 		// automatically stop any other that may be playing at that time. So
 		// that is what we do here, but we make an exception for speech.
@@ -836,7 +810,7 @@
 	if (_sfxMode & 2) {
 		if (_vm->_imuseDigital) {
 			_vm->_imuseDigital->stopSound(kTalkSoundID);
-		} else if (_vm->_heversion >= 70) {
+		} else if (_vm->_heversion >= 60) {
 			_vm->_mixer->stopID(1);
 		} else {
 			_vm->_mixer->stopHandle(_talkChannelHandle);

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sound.h,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- sound.h	25 Apr 2005 05:44:12 -0000	1.85
+++ sound.h	8 May 2005 14:31:27 -0000	1.86
@@ -107,6 +107,7 @@
 	void processSoundQues();
 	void setOverrideFreq(int freq);
 	void playSound(int soundID, int heOffset, int heChannel, int heFlags);
+	void startHETalkSound(uint32 offset);
 	void startTalkSound(uint32 offset, uint32 b, int mode, SoundHandle *handle = NULL);
 	void stopTalkSound();
 	bool isMouthSyncOff(uint pos);

Index: string.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/string.cpp,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -d -r1.288 -r1.289
--- string.cpp	7 May 2005 09:53:06 -0000	1.288
+++ string.cpp	8 May 2005 14:31:27 -0000	1.289
@@ -274,7 +274,7 @@
 				value[i] = 0;
 				talk_sound_b = atoi(value);
 
-				_sound->talkSound(talk_sound_a, talk_sound_b, 2);
+				_sound->startHETalkSound(talk_sound_a);
 				break;
 			case 104:
 				_haveMsg = 0;
@@ -295,7 +295,7 @@
 				talk_sound_a = atoi(value);
 				talk_sound_b = 0;
 
-				_sound->talkSound(talk_sound_a, talk_sound_b, 2);
+				_sound->startHETalkSound(talk_sound_a);
 				break;
 			case 119:
 				if (_haveMsg != 0xFE)
@@ -335,7 +335,11 @@
 				talk_sound_b = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24);
 				buffer += 14;
 	
-				_sound->talkSound(talk_sound_a, talk_sound_b, 2);
+				if (_heversion >= 60) {
+					_sound->startHETalkSound(talk_sound_a);
+				} else {
+					_sound->talkSound(talk_sound_a, talk_sound_b, 2);
+				}
 
 				// Set flag that speech variant exist of this msg.
 				// This is actually a hack added by ScummVM; the original did
@@ -393,6 +397,8 @@
 			} else {
 				if ((_imuseDigital && _sound->isSoundRunning(kTalkSoundID)) && (!ConfMan.getBool("subtitles") || VAR(VAR_VOICE_MODE) == 0)) {
 					// Special case for games using imuse digital.for sound
+				} else if (_heversion >= 60 && !ConfMan.getBool("subtitles") && _sound->isSoundRunning(1)) {
+					// Special case for HE games
 				} else if ((_gameId == GID_LOOM256) && !ConfMan.getBool("subtitles") && (_sound->pollCD())) {
 					// Special case for loomcd, since it only uses CD audio.for sound
 				} else if (!ConfMan.getBool("subtitles") && (_haveMsg == 0xFE || _mixer->isSoundHandleActive(_sound->_talkChannelHandle))) {





More information about the Scummvm-git-logs mailing list