[Scummvm-cvs-logs] CVS: scummvm/sky disk.cpp,1.36,1.37 logic.cpp,1.115,1.116 sound.cpp,1.24,1.25 sound.h,1.11,1.12

Robert G?ffringmann lavosspawn at users.sourceforge.net
Mon Jul 7 07:59:11 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv7945/sky

Modified Files:
	disk.cpp logic.cpp sound.cpp sound.h 
Log Message:
applied patch #766979 (BASS: Possible fix for problem with cut-off speech).
added small change to SFX samplerate, sparky doesn't sound like a bird now, either.

Index: disk.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/disk.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- disk.cpp	7 Jul 2003 02:54:59 -0000	1.36
+++ disk.cpp	7 Jul 2003 14:58:53 -0000	1.37
@@ -309,7 +309,6 @@
 
 void SkyDisk::fnCacheFiles(void) {
 
-	// call trash_all_fx
 	uint16 lCnt, bCnt, targCnt;
 	targCnt = lCnt = 0;
 	bool found;

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- logic.cpp	7 Jul 2003 01:36:24 -0000	1.115
+++ logic.cpp	7 Jul 2003 14:58:53 -0000	1.116
@@ -1350,13 +1350,12 @@
 }
 
 bool SkyLogic::fnCacheChip(uint32 a, uint32 b, uint32 c) {
-	debug(5, "SkyDisk::fnCacheChip(%d);\n",a);
+	_skySound->fnStopFx();
 	_skyDisk->fnCacheChip(a);
 	return true;
 }
 
 bool SkyLogic::fnCacheFast(uint32 a, uint32 b, uint32 c) {
-	debug(5, "SkyDisk::fnCacheFast(%d);\n",a);
 	_skyDisk->fnCacheFast(a);
 	return true;
 }

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- sound.cpp	7 Jul 2003 02:32:20 -0000	1.24
+++ sound.cpp	7 Jul 2003 14:58:53 -0000	1.25
@@ -33,6 +33,14 @@
 #pragma START_PACK_STRUCTS
 #endif
 
+enum {
+	SOUND_CH0    = 0,
+	SOUND_CH1    = 1,
+	SOUND_BG     = 2,
+	SOUND_VOICE  = 3,
+	SOUND_SPEECH = 4
+};
+
 struct RoomList {
 	uint8 room;
 	uint8 adlibVolume;
@@ -1021,7 +1029,6 @@
 	_bgSoundHandle = 0;
 	_ingameSpeech = 0;
 	_ingameSound0 = _ingameSound1 = 0;
-	_spSlot = _slot0 = _slot1 = -1;
 	_saveSounds[0] = _saveSounds[1] = 0xFFFF;
 }
 
@@ -1033,17 +1040,19 @@
 
 int SkySound::playVoice(byte *sound, uint32 size) {
 
-	return playSound(sound, size, &_voiceHandle);
+	_mixer->stopID(SOUND_VOICE);
+	return playSound(SOUND_VOICE, sound, size, &_voiceHandle);
 }
 
 
 int SkySound::playBgSound(byte *sound, uint32 size) {
 
 	size -= 512; //Hack to get rid of the annoying pop at the end of some bg sounds 
-	return playSound(sound, size, &_bgSoundHandle);
+	_mixer->stopID(SOUND_BG);
+	return playSound(SOUND_BG, sound, size, &_bgSoundHandle);
 }
 
-int SkySound::playSound(byte *sound, uint32 size, PlayingSoundHandle *handle) {
+int SkySound::playSound(uint32 id, byte *sound, uint32 size, PlayingSoundHandle *handle) {
 
 	byte flags = 0;
 	flags |= SoundMixer::FLAG_UNSIGNED|SoundMixer::FLAG_AUTOFREE;
@@ -1051,7 +1060,8 @@
 	byte *buffer = (byte *)malloc(size); 
 	memcpy(buffer, sound+sizeof(struct dataFileHeader), size);	
 	
-	return _mixer->playRaw(handle, buffer, size, 11025, flags);
+	_mixer->stopID(id);
+	return _mixer->playRaw(handle, buffer, size, 11025, flags, id);
 }
 
 void SkySound::loadSection(uint8 pSection) {
@@ -1074,17 +1084,10 @@
 
 void SkySound::playSound(uint16 sound, uint16 volume, uint8 channel) {
 
-	if (channel == 0) {
-		if ((_slot0 >= 0) && ((_slot0 != _spSlot) || (!_ingameSpeech))) {
-			_mixer->stop(_slot0);
-			_slot0 = -1;
-		}
-	} else {
-		if ((_slot1 >= 0) && ((_slot1 != _spSlot) || (!_ingameSpeech))){
-			_mixer->stop(_slot1);
-			_slot1 = -1;
-		}
-	}
+	if (channel == 0)
+		_mixer->stopID(SOUND_CH0);
+	else
+		_mixer->stopID(SOUND_CH1);
 
 	if (!_soundData) {
 		warning("SkySound::playSound(%04X, %04X) called with a section having been loaded.\n", sound, volume);
@@ -1101,6 +1104,8 @@
 	
 	// note: all those tables are big endian. Don't ask me why. *sigh*
 	uint16 sampleRate = (_sampleRates[sound << 2] << 8) | _sampleRates[(sound << 2) | 1];
+	if (sampleRate > 11025)
+		sampleRate = 11025;
 	uint32 dataOfs = ((_sfxInfo[sound << 3] << 8) | _sfxInfo[(sound << 3) | 1]) << 4;
 	dataOfs += _sfxBaseOfs;
 	uint16 dataSize = (_sfxInfo[(sound << 3) | 2] << 8) | _sfxInfo[(sound << 3) | 3];
@@ -1113,9 +1118,9 @@
 	
 	_mixer->setVolume(volume);
 	if (channel == 0)
-		_slot0 = _mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, sampleRate, flags);
+		_mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH0);
 	else
-		_slot1 = _mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, sampleRate, flags);
+		_mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH1);
 }
 
 void SkySound::fnStartFx(uint32 sound, uint8 channel) {
@@ -1205,9 +1210,8 @@
 }
 
 void SkySound::fnStopFx(void) {
-	if (_slot0 >= 0) _mixer->stop(_slot0);
-	if (_slot1 >= 0) _mixer->stop(_slot1);
-	_slot0 = _slot1 = -1;
+	_mixer->stopID(SOUND_CH0);
+	_mixer->stopID(SOUND_CH1);
 	_saveSounds[0] = _saveSounds[1] = 0xFFFF;
 }
 
@@ -1229,6 +1233,7 @@
 
 	free(speechData);
 
-	_spSlot = _mixer->playRaw(&_ingameSpeech, playBuffer, speechSize, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
+	_mixer->stopID(SOUND_SPEECH);
+	_mixer->playRaw(&_ingameSpeech, playBuffer, speechSize, 11025, SoundMixer::FLAG_UNSIGNED | SoundMixer::FLAG_AUTOFREE);
 	return true;
 }

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- sound.h	5 Jul 2003 03:05:54 -0000	1.11
+++ sound.h	7 Jul 2003 14:58:53 -0000	1.12
@@ -47,7 +47,7 @@
 
 protected:
 
-	int playSound(byte *sound, uint32 size, PlayingSoundHandle *handle);
+	int playSound(uint32 id, byte *sound, uint32 size, PlayingSoundHandle *handle);
 
 public:
 	SkySound(SoundMixer *mixer, SkyDisk *pDisk);
@@ -72,7 +72,6 @@
 	uint16 _sfxBaseOfs;
 	uint8 *_soundData;
 	uint8 *_sampleRates, *_sfxInfo;
-	int _slot0, _slot1, _spSlot;
 
 	static uint16 _speechConvertTable[8];
 	static SfxQueue _sfxQueue[MAX_QUEUED_FX];





More information about the Scummvm-git-logs mailing list