[Scummvm-cvs-logs] SF.net SVN: scummvm:[49415] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jun 4 00:00:51 CEST 2010


Revision: 49415
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49415&view=rev
Author:   thebluegr
Date:     2010-06-03 22:00:50 +0000 (Thu, 03 Jun 2010)

Log Message:
-----------
Added code to get which channels are used by a sound. Also, fixed a crash when using Sierra's GM patches, a regression from commit #49391.

Modified Paths:
--------------
    scummvm/trunk/engines/sci/resource.h
    scummvm/trunk/engines/sci/resource_audio.cpp

Modified: scummvm/trunk/engines/sci/resource.h
===================================================================
--- scummvm/trunk/engines/sci/resource.h	2010-06-03 21:57:49 UTC (rev 49414)
+++ scummvm/trunk/engines/sci/resource.h	2010-06-03 22:00:50 UTC (rev 49415)
@@ -512,6 +512,7 @@
 	Track *getDigitalTrack();
 	int getChannelFilterMask(int hardwareMask, bool wantsRhythm);
 	byte getInitialVoiceCount(byte channel);
+	bool isChannelUsed(byte channel) { return _usedChannels[channel]; }
 
 private:
 	SciVersion _soundVersion;
@@ -519,6 +520,7 @@
 	Track *_tracks;
 	Resource *_innerResource;
 	ResourceManager *_resMan;
+	bool _usedChannels[16];
 };
 
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/resource_audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource_audio.cpp	2010-06-03 21:57:49 UTC (rev 49414)
+++ scummvm/trunk/engines/sci/resource_audio.cpp	2010-06-03 22:00:50 UTC (rev 49415)
@@ -151,6 +151,7 @@
 	if (!gmPatchFile.empty() && Common::File::exists(gmPatchFile)) {
 		ResourceSource *psrcPatch = new ResourceSource;
 		psrcPatch->source_type = kSourcePatch;
+		psrcPatch->resourceFile = 0;
 		psrcPatch->location_name = gmPatchFile;
 		processPatch(psrcPatch, kResourceTypePatch, 4);
 	}
@@ -467,6 +468,9 @@
 	byte *dataEnd;
 	Channel *channel, *sampleChannel;
 
+	for (int i = 0; i < 16; i++)
+		_usedChannels[i] = false;
+
 	switch (_soundVersion) {
 	case SCI_VERSION_0_EARLY:
 	case SCI_VERSION_0_LATE:
@@ -556,6 +560,7 @@
 					channel->data = resource->data + READ_LE_UINT16(data + 2) + 2;
 					channel->size = READ_LE_UINT16(data + 4) - 2; // Not counting channel header
 					channel->number = *(channel->data - 2);
+					_usedChannels[channel->number] = true;
 					channel->poly = *(channel->data - 1);
 					channel->time = channel->prev = 0;
 					if (channel->number == 0xFE) { // Digital channel


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