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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jun 4 17:01:26 CEST 2010


Revision: 49430
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49430&view=rev
Author:   thebluegr
Date:     2010-06-04 15:01:26 +0000 (Fri, 04 Jun 2010)

Log Message:
-----------
Some more work on channel remapping: Moved the remapping code to the music loading code (still disabled)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
    scummvm/trunk/engines/sci/sound/midiparser_sci.h
    scummvm/trunk/engines/sci/sound/music.cpp

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-06-04 14:53:12 UTC (rev 49429)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.cpp	2010-06-04 15:01:26 UTC (rev 49430)
@@ -88,7 +88,6 @@
 	_tracks[0] = _mixedData;
 	setTrack(0);
 	_loopTick = 0;
-	_channelsUsed = 0;
 
 	if (_soundVersion <= SCI_VERSION_0_LATE) {
 		// Set initial voice count
@@ -135,12 +134,6 @@
 }
 
 void MidiParser_SCI::parseNextEvent(EventInfo &info) {
-	byte remappedChannel = _channelRemap[info.channel()];
-
-	// Remap channel. Keep the upper 4 bits (command code) and change
-	// the lower 4 bits (channel)
-	info.event = (info.event & 0xF0) | (remappedChannel & 0xF);
-
 	// Monitor which channels are used by this song
 	setChannelUsed(info.channel());
 
@@ -334,7 +327,7 @@
 	for (int i = 0; i < _track->channelCount; i++) {
 		if (_track->channels[i].time == -1) // channel ended
 			continue;
-		next = *_track->channels[i].data; // when the next event shoudl occur
+		next = *_track->channels[i].data; // when the next event should occur
 		if (next == 0xF8) // 0xF8 means 240 ticks delay
 			next = 240;
 		next += _track->channels[i].time;
@@ -401,9 +394,18 @@
 			channel->time = -1; // FIXME
 			break;
 		default: // MIDI command
-			if (command & 0x80)
+			if (command & 0x80) {
 				par1 = *channel->data++;
-			else {// running status
+
+				// TODO: Fix remapping
+
+#if 0
+				// Remap channel. Keep the upper 4 bits (command code) and change
+				// the lower 4 bits (channel)
+				byte remappedChannel = _channelRemap[par1 & 0xF];
+				par1 = (par1 & 0xF0) | (remappedChannel & 0xF);
+#endif
+			} else {// running status
 				par1 = command;
 				command = channel->prev;
 			}

Modified: scummvm/trunk/engines/sci/sound/midiparser_sci.h
===================================================================
--- scummvm/trunk/engines/sci/sound/midiparser_sci.h	2010-06-04 14:53:12 UTC (rev 49429)
+++ scummvm/trunk/engines/sci/sound/midiparser_sci.h	2010-06-04 15:01:26 UTC (rev 49430)
@@ -77,6 +77,8 @@
 		_channelRemap[channel] = newChannel;
 	}
 
+	void clearUsedChannels() { _channelsUsed = 0; }
+
 protected:
 	bool isChannelUsed(byte channel) const { return _channelsUsed & (1 << channel); }
 	void setChannelUsed(byte channel) { _channelsUsed |= (1 << channel); }

Modified: scummvm/trunk/engines/sci/sound/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/music.cpp	2010-06-04 14:53:12 UTC (rev 49429)
+++ scummvm/trunk/engines/sci/sound/music.cpp	2010-06-04 15:01:26 UTC (rev 49430)
@@ -231,15 +231,13 @@
 
 			pSnd->pauseCounter = 0;
 
-			// Find out what channels to filter for SCI0
-			channelFilterMask = pSnd->soundRes->getChannelFilterMask(_pMidiDrv->getPlayId(), _pMidiDrv->hasRhythmChannel());
-			pSnd->pMidiParser->loadMusic(track, pSnd, channelFilterMask, _soundVersion);
-
 			// TODO: Fix channel remapping. This doesn't quite work... (e.g. no difference in LSL1VGA)
 #if 0
 			// Remap channels
 			findUsedChannels();
 
+			pSnd->pMidiParser->clearUsedChannels();
+
 			for (int i = 0; i < 16; i++) {
 				if (_usedChannels[i] && pSnd->soundRes->isChannelUsed(i)) {
 					int16 newChannel = getNextUnusedChannel();
@@ -254,6 +252,10 @@
 			}
 #endif
 
+			// Find out what channels to filter for SCI0
+			channelFilterMask = pSnd->soundRes->getChannelFilterMask(_pMidiDrv->getPlayId(), _pMidiDrv->hasRhythmChannel());
+			pSnd->pMidiParser->loadMusic(track, pSnd, channelFilterMask, _soundVersion);
+
 			// Fast forward to the last position and perform associated events when loading
 			pSnd->pMidiParser->jumpToTick(pSnd->ticker, true);
 			_mutex.unlock();


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