[Scummvm-cvs-logs] CVS: scummvm/sky sound.cpp,1.6,1.7 sound.h,1.3,1.4

Robert G?ffringmann lavosspawn at users.sourceforge.net
Thu May 29 09:48:04 CEST 2003


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

Modified Files:
	sound.cpp sound.h 
Log Message:
fixed sound driver.

Index: sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sound.cpp	20 May 2003 19:39:32 -0000	1.6
+++ sound.cpp	29 May 2003 16:47:14 -0000	1.7
@@ -24,7 +24,6 @@
 #include "sky/struc.h"
 
 #define SOUND_FILE_BASE 60203
-#define SFX_BASE 0xA60
 
 SkySound::SkySound(SoundMixer *mixer, SkyDisk *pDisk) {
 	_skyDisk = pDisk;
@@ -71,8 +70,14 @@
 	_ingameSound = 0;
 	if (_soundData) free(_soundData);
 	_soundData = _skyDisk->loadFile(pSection * 4 + SOUND_FILE_BASE, NULL);
-	_sampleRates = _soundData + 0xA4E;
-	_sfxInfo = _soundData + 0xA60;
+	if ((_soundData[0x7E] != 0x3C) || (_soundData[0xA5] != 0x8D) || (_soundData[0xA6] != 0x1E) ||
+		(_soundData[0xAD] != 0x8D) || (_soundData[0xAE] != 0x36))
+		error("Unknown sounddriver version!\n");
+	_soundsTotal = _soundData[0x7F];
+	uint16 sRateTabOfs = (_soundData[0xA8] << 8) | _soundData[0xA7];
+	_sfxBaseOfs = (_soundData[0xB0] << 8) | _soundData[0xAF];
+	_sampleRates = _soundData + sRateTabOfs;
+	_sfxInfo = _soundData + _sfxBaseOfs;
 }
 
 void SkySound::playSound(uint16 sound, uint16 volume) {
@@ -82,7 +87,7 @@
 		return;
 	}
 	
-	if (sound > 2) {
+	if (sound > _soundsTotal) {
 		if (sound & 0x80) warning("SkySound::playSound(%04X, %04X) not implemented.\n", sound, volume);
 		else warning("SkySound::playSound(%04X, %04X) ignored.\n", sound, volume);
 		return ;
@@ -94,7 +99,7 @@
 	// note: all those tables are big endian. Don't ask me why. *sigh*
 	uint16 sampleRate = (_sampleRates[sound << 2] << 8) | _sampleRates[(sound << 2) | 1];
 	uint16 dataOfs = ((_sfxInfo[sound << 3] << 8) | _sfxInfo[(sound << 3) | 1]) << 4;
-	dataOfs += SFX_BASE;
+	dataOfs += _sfxBaseOfs;
 	uint16 dataSize = (_sfxInfo[(sound << 3) | 2] << 8) | _sfxInfo[(sound << 3) | 3];
 	uint16 dataLoop = (_sfxInfo[(sound << 3) | 6] << 8) | _sfxInfo[(sound << 3) | 7];
 

Index: sound.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sound.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sound.h	16 May 2003 15:33:18 -0000	1.3
+++ sound.h	29 May 2003 16:47:14 -0000	1.4
@@ -49,6 +49,8 @@
 
 private:
 	SkyDisk *_skyDisk;
+	uint8 _soundsTotal;
+	uint16 _sfxBaseOfs;
     uint8 *_soundData;
 	uint8 *_sampleRates, *_sfxInfo;
 };





More information about the Scummvm-git-logs mailing list