[Scummvm-cvs-logs] CVS: scummvm/scumm imuse.cpp,2.131,2.132 imuse_internal.h,2.41,2.42 imuse_player.cpp,2.48,2.49

Max Horn fingolfin at users.sourceforge.net
Wed May 25 02:33:58 CEST 2005


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23641

Modified Files:
	imuse.cpp imuse_internal.h imuse_player.cpp 
Log Message:
Changed misleading 'isGM' name to 'isMIDI'; cleanup in the isMIDI/isMT32 methods

Index: imuse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse.cpp,v
retrieving revision 2.131
retrieving revision 2.132
diff -u -d -r2.131 -r2.132
--- imuse.cpp	23 May 2005 07:05:41 -0000	2.131
+++ imuse.cpp	25 May 2005 09:32:19 -0000	2.132
@@ -32,6 +32,7 @@
 #include "scumm/instrument.h"
 #include "scumm/saveload.h"
 #include "scumm/scumm.h"
+#include "scumm/util.h"
 
 #include "sound/mididrv.h"
 
@@ -95,7 +96,7 @@
 	ptr += 4;
 
 	// Okay, we're looking for one of those things: either
-	// an 'MThd' tag(for SMF), or a 'FORM' tag(for XMIDI).
+	// an 'MThd' tag (for SMF), or a 'FORM' tag (for XMIDI).
 	size = 48; // Arbitrary; we should find our tag within the first 48 bytes of the resource
 	pos = 0;
 	while (pos < size) {
@@ -122,16 +123,15 @@
 	switch (tag) {
 	case MKID('ADL '):
 	case MKID('ASFX'): // Special AD class for old Adlib sound effects
+	case MKID('SPK '):
 		return false;
+
 	case MKID('AMI '):
-		return true;
 	case MKID('ROL '):
-		return true;
-	case MKID('GMD '):
-		return false;
 	case MKID('MAC '):
 		return true;
-	case MKID('SPK '):
+
+	case MKID('GMD '):
 		return false;
 	}
 
@@ -142,10 +142,12 @@
 	if (ptr[8] == 'S' && ptr[9] == 'O')
 		return false;
 
+	warning("Unknown music type: '%s'", tag2str(tag));
+
 	return false;
 }
 
-bool IMuseInternal::isGM(int sound) {
+bool IMuseInternal::isMIDI(int sound) {
 	byte *ptr = NULL;
 	uint32 tag;
 
@@ -159,19 +161,17 @@
 	switch (tag) {
 	case MKID('ADL '):
 	case MKID('ASFX'): // Special AD class for old Adlib sound effects
+	case MKID('SPK '):
+		return false;
 		return false;
 	case MKID('AMI '):
-		return true; // Yeah... for our purposes, this is GM
 	case MKID('ROL '):
-		return true; // Yeah... for our purposes, this is GM
-	case MKID('GMD '):
+	case MKID('MAC '):
 		return true;
+
+	case MKID('GMD '):
 	case MKID('MIDI'):
 		return true;
-	case MKID('MAC '):
-		return true; // I guess this one too, since it qualifies under isMT32()
-	case MKID('SPK '):
-		return false;
 	}
 
 	// Old style 'RO' has equivalent properties to 'ROL'
@@ -182,13 +182,15 @@
 	if (ptr[8] == 'S' && ptr[9] == 'O')
 		return true;
 
+	warning("Unknown music type: '%s'", tag2str(tag));
+
 	return false;
 }
 
 MidiDriver *IMuseInternal::getBestMidiDriver(int sound) {
 	MidiDriver *driver = NULL;
 
-	if (isGM(sound)) {
+	if (isMIDI(sound)) {
 		if (_midi_native) {
 			driver = _midi_native;
 		} else {
@@ -1736,7 +1738,7 @@
 void Part::setup(Player *player) {
 	_player = player;
 
-	_percussion = (player->isGM() && _chan == 9); // true;
+	_percussion = (player->isMIDI() && _chan == 9); // true;
 	_on = true;
 	_pri_eff = player->getPriority();
 	_pri = 0;

Index: imuse_internal.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_internal.h,v
retrieving revision 2.41
retrieving revision 2.42
diff -u -d -r2.41 -r2.42
--- imuse_internal.h	8 May 2005 21:49:45 -0000	2.41
+++ imuse_internal.h	25 May 2005 09:32:19 -0000	2.42
@@ -184,7 +184,7 @@
 	ParameterFader _parameterFaders[4];
 
 	bool _isMT32;
-	bool _isGM;
+	bool _isMIDI;
 
 protected:
 	// Player part
@@ -239,7 +239,7 @@
 	byte getVolume() const { return _volume; }
 	bool isActive() const { return _active; }
 	bool isFadingOut() const;
-	bool isGM() const { return _isGM; }
+	bool isMIDI() const { return _isMIDI; }
 	bool isMT32() const { return _isMT32; }
 	bool jump(uint track, uint beat, uint tick);
 	void onTimer();
@@ -389,7 +389,7 @@
 protected:
 	byte *findStartOfSound(int sound);
 	bool isMT32(int sound);
-	bool isGM(int sound);
+	bool isMIDI(int sound);
 	int get_queue_sound_status(int sound) const;
 	void handle_marker(uint id, byte data);
 	int get_channel_volume(uint a);

Index: imuse_player.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/imuse_player.cpp,v
retrieving revision 2.48
retrieving revision 2.49
diff -u -d -r2.48 -r2.49
--- imuse_player.cpp	7 Jan 2005 14:42:51 -0000	2.48
+++ imuse_player.cpp	25 May 2005 09:32:19 -0000	2.49
@@ -79,7 +79,7 @@
 	_loop_from_tick(0),
 	_speed(128),
 	_isMT32(false),
-	_isGM(false),
+	_isMIDI(false),
 	_se(0),
 	_vol_chan(0){
 }
@@ -104,7 +104,7 @@
 	}
 
 	_isMT32 = _se->isMT32(sound);
-	_isGM = _se->isGM(sound);
+	_isMIDI = _se->isMIDI(sound);
 
 	_parts = NULL;
 	_active = true;
@@ -313,7 +313,7 @@
 	case 0xC: // Program Change
 		part = getPart(chan);
 		if (part) {
-			if (_isGM) {
+			if (_isMIDI) {
 				if (param1 < 128)
 					part->programChange(param1);
 			} else {
@@ -414,7 +414,7 @@
 				part->set_onoff(p[2] & 0x01);
 				part->set_pri (p[4]);
 				part->volume((p[5] & 0x0F) << 4 |(p[6] & 0x0F));
-				part->_percussion = _isGM ?((p[9] & 0x08) > 0) : false;
+				part->_percussion = _isMIDI ?((p[9] & 0x08) > 0) : false;
 				if (part->_percussion) {
 					if (part->_mc) {
 						part->off();
@@ -426,7 +426,7 @@
 					// 0 is a valid program number. MI2 tests show that in such
 					// cases, a regular program change message always seems to follow
 					// anyway.
-					if (_isGM)
+					if (_isMIDI)
 						part->_instrument.program((p[15] & 0x0F) << 4 |(p[16] & 0x0F), _isMT32);
 					part->sendAll();
 				}
@@ -1144,7 +1144,7 @@
 		if (_parser)
 			_parser->jumpToTick(_music_tick); // start_seq_sound already switched tracks
 		_isMT32 = _se->isMT32(_id);
-		_isGM = _se->isGM(_id);
+		_isMIDI = _se->isMIDI(_id);
 	}
 }
 





More information about the Scummvm-git-logs mailing list