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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jun 4 16:53:12 CEST 2010


Revision: 49429
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49429&view=rev
Author:   thebluegr
Date:     2010-06-04 14:53:12 +0000 (Fri, 04 Jun 2010)

Log Message:
-----------
Simplified the channel monitoring code inside the SoundResource class

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-04 13:48:09 UTC (rev 49428)
+++ scummvm/trunk/engines/sci/resource.h	2010-06-04 14:53:12 UTC (rev 49429)
@@ -512,7 +512,7 @@
 	Track *getDigitalTrack();
 	int getChannelFilterMask(int hardwareMask, bool wantsRhythm);
 	byte getInitialVoiceCount(byte channel);
-	bool isChannelUsed(byte channel) { return _usedChannels[channel]; }
+	bool isChannelUsed(byte channel) const { return _channelsUsed & (1 << channel); }
 
 private:
 	SciVersion _soundVersion;
@@ -520,7 +520,9 @@
 	Track *_tracks;
 	Resource *_innerResource;
 	ResourceManager *_resMan;
-	bool _usedChannels[16];
+	uint16 _channelsUsed;
+
+	void setChannelUsed(byte channel) { _channelsUsed |= (1 << channel); }
 };
 
 } // End of namespace Sci

Modified: scummvm/trunk/engines/sci/resource_audio.cpp
===================================================================
--- scummvm/trunk/engines/sci/resource_audio.cpp	2010-06-04 13:48:09 UTC (rev 49428)
+++ scummvm/trunk/engines/sci/resource_audio.cpp	2010-06-04 14:53:12 UTC (rev 49429)
@@ -468,8 +468,7 @@
 	byte *dataEnd;
 	Channel *channel, *sampleChannel;
 
-	for (int i = 0; i < 16; i++)
-		_usedChannels[i] = false;
+	_channelsUsed = 0;
 
 	switch (_soundVersion) {
 	case SCI_VERSION_0_EARLY:
@@ -560,7 +559,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;
+					setChannelUsed(channel->number);
 					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