[Scummvm-cvs-logs] SF.net SVN: scummvm: [23217] scummvm/branches/branch-0-9-0/engines/sky

kirben at users.sourceforge.net kirben at users.sourceforge.net
Wed Jun 21 13:31:37 CEST 2006


Revision: 23217
Author:   kirben
Date:     2006-06-21 04:31:31 -0700 (Wed, 21 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23217&view=rev

Log Message:
-----------
Add eriktorbjorn's patch for bug #1507757 - BASS: Odd press sound at beginning

Modified Paths:
--------------
    scummvm/branches/branch-0-9-0/engines/sky/sound.cpp
    scummvm/branches/branch-0-9-0/engines/sky/sound.h
Modified: scummvm/branches/branch-0-9-0/engines/sky/sound.cpp
===================================================================
--- scummvm/branches/branch-0-9-0/engines/sky/sound.cpp	2006-06-21 10:28:09 UTC (rev 23216)
+++ scummvm/branches/branch-0-9-0/engines/sky/sound.cpp	2006-06-21 11:31:31 UTC (rev 23217)
@@ -1070,7 +1070,9 @@
 			error("Unknown sounddriver version!");
 
 	_soundsTotal = _soundData[asmOfs + 1];
+	uint16 sRateTabOfs = READ_LE_UINT16(_soundData + asmOfs + 0x29);
 	_sfxBaseOfs = READ_LE_UINT16(_soundData + asmOfs + 0x31);
+	_sampleRates = _soundData + sRateTabOfs;
 
 	_sfxInfo = _soundData + _sfxBaseOfs;
 	// if we just restored a savegame, the sfxqueue holds the sound we need to restart
@@ -1099,7 +1101,12 @@
 	volume = (volume & 0x7F) << 1;
 	sound &= 0xFF;
 
-	// note: all those tables are big endian. Don't ask me why. *sigh*
+	// Note: All those tables are big endian. Don't ask me why. *sigh*
+
+	// Use the sample rate from game data, see bug #1507757.
+	uint16 sampleRate = READ_BE_UINT16(_sampleRates + (sound << 2));
+	if (sampleRate > 11025)
+		sampleRate = 11025;
 	uint32 dataOfs  = READ_BE_UINT16(_sfxInfo + (sound << 3) + 0) << 4;
 	uint32 dataSize = READ_BE_UINT16(_sfxInfo + (sound << 3) + 2);
 	uint32 dataLoop = READ_BE_UINT16(_sfxInfo + (sound << 3) + 6);
@@ -1115,9 +1122,9 @@
 	}
 
 	if (channel == 0)
-		_mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, 11025, flags, SOUND_CH0, volume, 0, loopSta, loopEnd);
+		_mixer->playRaw(&_ingameSound0, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH0, volume, 0, loopSta, loopEnd);
 	else
-		_mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, 11025, flags, SOUND_CH1, volume, 0, loopSta, loopEnd);
+		_mixer->playRaw(&_ingameSound1, _soundData + dataOfs, dataSize, sampleRate, flags, SOUND_CH1, volume, 0, loopSta, loopEnd);
 }
 
 void Sound::fnStartFx(uint32 sound, uint8 channel) {

Modified: scummvm/branches/branch-0-9-0/engines/sky/sound.h
===================================================================
--- scummvm/branches/branch-0-9-0/engines/sky/sound.h	2006-06-21 10:28:09 UTC (rev 23216)
+++ scummvm/branches/branch-0-9-0/engines/sky/sound.h	2006-06-21 11:31:31 UTC (rev 23217)
@@ -83,7 +83,7 @@
 	Disk *_skyDisk;
 	uint16 _sfxBaseOfs;
 	uint8 *_soundData;
-	uint8 *_sfxInfo;
+	uint8 *_sampleRates, *_sfxInfo;
 	uint8 _mainSfxVolume;
 
 	static uint16 _speechConvertTable[8];


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