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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Nov 4 17:11:47 CET 2009


Revision: 45672
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45672&view=rev
Author:   thebluegr
Date:     2009-11-04 16:11:46 +0000 (Wed, 04 Nov 2009)

Log Message:
-----------
Applied patch #2891232 - "SCI sfx: Let each SongIterator remap its own channels"

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/iterator.cpp
    scummvm/trunk/engines/sci/sfx/iterator.h
    scummvm/trunk/engines/sci/sfx/iterator_internal.h

Modified: scummvm/trunk/engines/sci/sfx/iterator.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/iterator.cpp	2009-11-04 16:11:44 UTC (rev 45671)
+++ scummvm/trunk/engines/sci/sfx/iterator.cpp	2009-11-04 16:11:46 UTC (rev 45672)
@@ -376,6 +376,18 @@
 		if ((cmd & 0xf0) == 0x90) /* note on? */
 			channel->notes_played++;
 
+#if 0
+		/* Perform remapping, if neccessary */
+		if (cmd != SCI_MIDI_SET_SIGNAL
+				&& cmd < 0xf0) { /* Not a generic command */
+			int chan = cmd & 0xf;
+			int op = cmd & 0xf0;
+
+			chan = channel_remap[chan];
+			buf[0] = chan | op;
+		}
+#endif
+
 		/* Process as normal MIDI operation */
 		return 0;
 	}
@@ -1364,12 +1376,6 @@
 	_children[TEE_LEFT].it = left;
 	_children[TEE_RIGHT].it = right;
 
-	// By default, don't remap
-	for (i = 0; i < 16; i++) {
-		_children[TEE_LEFT].channel_remap[i] = i;
-		_children[TEE_RIGHT].channel_remap[i] = i;
-	}
-
 	/* Default to lhs channels */
 	channel_mask = left->channel_mask;
 	for (i = 0; i < 16; i++)
@@ -1386,7 +1392,7 @@
 				//warning("[songit-tee <%08lx,%08lx>] Could not remap right channel #%d: Out of channels",
 				//        left->ID, right->ID, i);
 			} else {
-				_children[TEE_RIGHT].channel_remap[i] = firstfree;
+				_children[TEE_RIGHT].it->channel_remap[i] = firstfree;
 
 				channel_mask |= (1 << firstfree);
 			}
@@ -1402,7 +1408,7 @@
 		for (c = 0 ; c < 2; c++)
 			for (i = 0 ; i < 16; i++)
 				fprintf(stderr, "  map [%d][%d] -> %d\n",
-				        c, i, _children[c].channel_remap[i]);
+				        c, i, _children[c].it->channel_remap[i]);
 	}
 #endif
 
@@ -1514,22 +1520,7 @@
 	fprintf(stderr, "\tl:%d / r:%d / chose %d\n",
 	        _children[TEE_LEFT].retval, _children[TEE_RIGHT].retval, retid);
 #endif
-#if 0
-	if (_children[retid].retval == 0) {
-		/* Perform remapping, if neccessary */
-		byte *buf = _children[retid].buf;
-		if (*buf != SCI_MIDI_SET_SIGNAL
-		        && *buf < 0xf0) { /* Not a generic command */
-			int chan = *buf & 0xf;
-			int op = *buf & 0xf0;
 
-			chan = _children[retid].channel_remap[chan];
-
-			*buf = chan | op;
-		}
-	}
-#endif
-
 	/* Adjust delta times */
 	if (_children[retid].retval > 0
 	        && _children[1-retid].retval > 0) {
@@ -1660,6 +1651,8 @@
 
 			SongIterator *old_it = *it;
 			*it = new CleanupSongIterator(channel_mask);
+			for(uint i = 0; i < MIDI_CHANNELS; i++)
+				(*it)->channel_remap[i] = old_it->channel_remap[i];
 			song_iterator_transfer_death_listeners(*it, old_it);
 			if (mask & IT_READER_MAY_FREE)
 				delete old_it;
@@ -1691,6 +1684,10 @@
 	fade.action = FADE_ACTION_NONE;
 	priority = 0;
 	memset(_deathListeners, 0, sizeof(_deathListeners));
+
+	// By default, don't remap
+	for (uint i = 0; i < 16; i++)
+		channel_remap[i] = i;
 }
 
 SongIterator::SongIterator(const SongIterator &si) {
@@ -1699,6 +1696,9 @@
 	fade = si.fade;
 	priority = si.priority;
 	memset(_deathListeners, 0, sizeof(_deathListeners));
+
+	for (uint i = 0; i < 16; i++)
+		channel_remap[i] = si.channel_remap[i];
 }
 
 

Modified: scummvm/trunk/engines/sci/sfx/iterator.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/iterator.h	2009-11-04 16:11:44 UTC (rev 45671)
+++ scummvm/trunk/engines/sci/sfx/iterator.h	2009-11-04 16:11:46 UTC (rev 45672)
@@ -29,6 +29,7 @@
 #define SCI_SFX_SFX_ITERATOR_H
 
 #include "sci/sfx/sfx_pcm.h"
+#include "sci/sfx/sci_midi.h"
 
 namespace Audio {
 	class AudioStream;
@@ -156,6 +157,7 @@
 
 	/* See songit_* for the constructor and non-virtual member functions */
 
+	byte channel_remap[MIDI_CHANNELS]; ///< Remapping for channels
 
 public:
 	SongIterator();

Modified: scummvm/trunk/engines/sci/sfx/iterator_internal.h
===================================================================
--- scummvm/trunk/engines/sci/sfx/iterator_internal.h	2009-11-04 16:11:44 UTC (rev 45671)
+++ scummvm/trunk/engines/sci/sfx/iterator_internal.h	2009-11-04 16:11:46 UTC (rev 45672)
@@ -256,10 +256,6 @@
 		byte buf[4];
 		int result;
 		int retval;
-
-		/* Remapping for channels */
-		byte channel_remap[MIDI_CHANNELS];
-
 	} _children[2];
 
 public:


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