[Scummvm-cvs-logs] SF.net SVN: scummvm:[47323] scummvm/trunk/engines/sci/sound/softseq/midi. cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Sat Jan 16 17:21:17 CET 2010


Revision: 47323
          http://scummvm.svn.sourceforge.net/scummvm/?rev=47323&view=rev
Author:   thebluegr
Date:     2010-01-16 16:21:17 +0000 (Sat, 16 Jan 2010)

Log Message:
-----------
Added detection for the appropriate GM music channel play mask

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sound/softseq/midi.cpp

Modified: scummvm/trunk/engines/sci/sound/softseq/midi.cpp
===================================================================
--- scummvm/trunk/engines/sci/sound/softseq/midi.cpp	2010-01-16 16:17:45 UTC (rev 47322)
+++ scummvm/trunk/engines/sci/sound/softseq/midi.cpp	2010-01-16 16:21:17 UTC (rev 47323)
@@ -86,6 +86,7 @@
 	};
 
 	bool _isMt32;
+	bool _isOldPatchFormat;
 	bool _hasReverb;
 	bool _playSwitch;
 	int _masterVolume;
@@ -102,7 +103,7 @@
 	byte _sysExBuf[kMaxSysExSize];
 };
 
-MidiPlayer_Midi::MidiPlayer_Midi() : _playSwitch(true), _masterVolume(15), _isMt32(false), _hasReverb(false) {
+MidiPlayer_Midi::MidiPlayer_Midi() : _playSwitch(true), _masterVolume(15), _isMt32(false), _hasReverb(false), _isOldPatchFormat(false) {
 	MidiDriverType midiType = MidiDriver::detectMusicDriver(MDT_MIDI);
 	_driver = createMidi(midiType);
 
@@ -511,6 +512,13 @@
 		res = resMan->findResource(ResourceId(kResourceTypePatch, 4), 0);
 		if (!res)
 			warning("Failed to locate GM patch, attempting to load MT-32 patch");
+
+		// Detect the format of patch 1, so that we know what play mask to use
+		Resource *resPatch1 = resMan->findResource(ResourceId(kResourceTypePatch, 1), 0);
+		if (!resPatch1)
+			_isOldPatchFormat = false;
+		else
+			_isOldPatchFormat = !isMt32GmPatch(resPatch1->data, resPatch1->size);
 	}
 
 	if (!res) {
@@ -576,7 +584,7 @@
 		if (_isMt32)
 			return 0x0c;
 		else
-			return 0x07;
+			return _isOldPatchFormat ? 0x0c : 0x07;
 	}
 }
 


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