[Scummvm-cvs-logs] scummvm master -> 5f77bcc74c1aac5179c78c53c69e73b0fdf37858

m-kiewitz m_kiewitz at users.sourceforge.net
Sun Jun 21 10:06:53 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5f77bcc74c AGOS: Accolade MT32: General MIDI mapping


Commit: 5f77bcc74c1aac5179c78c53c69e73b0fdf37858
    https://github.com/scummvm/scummvm/commit/5f77bcc74c1aac5179c78c53c69e73b0fdf37858
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-06-21T10:06:12+02:00

Commit Message:
AGOS: Accolade MT32: General MIDI mapping

- renamed _MT32 to _nativeMT32
this name doesn't really make sense, because MUNT isn't a native
MT32, but the name is common to the other engines
- implement MT32 -> General MIDI mapping in case no MT32 is
available
- implement dialog screen, so that user is told about General MIDI
mapping and that it may sound awful

Changed paths:
    engines/agos/drivers/accolade/mt32.cpp
    engines/agos/midi.cpp



diff --git a/engines/agos/drivers/accolade/mt32.cpp b/engines/agos/drivers/accolade/mt32.cpp
index 630198f..f863ffb 100644
--- a/engines/agos/drivers/accolade/mt32.cpp
+++ b/engines/agos/drivers/accolade/mt32.cpp
@@ -23,6 +23,8 @@
 #include "agos/agos.h"
 #include "agos/drivers/accolade/mididriver.h"
 
+#include "audio/mididrv.h"
+
 #include "common/config-manager.h"
 #include "common/file.h"
 #include "common/mutex.h"
@@ -69,7 +71,7 @@ public:
 protected:
 	Common::Mutex _mutex;
 	MidiDriver *_driver;
-	bool _MT32;
+	bool _nativeMT32; // native MT32, may also be our MUNT, or MUNT over MIDI
 
 	bool _isOpen;
 	int _baseFreq;
@@ -87,7 +89,7 @@ public:
 MidiDriver_Accolade_MT32::MidiDriver_Accolade_MT32() {
 	_driver = NULL;
 	_isOpen = false;
-	_MT32 = false;
+	_nativeMT32 = false;
 	_baseFreq = 250;
 
 	memset(_channelMapping, 0, sizeof(_channelMapping));
@@ -113,13 +115,14 @@ int MidiDriver_Accolade_MT32::open() {
 	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_PREFER_MT32);
 	MusicType musicType = MidiDriver::getMusicType(dev);
 
+	// check, if we got a real MT32 (or MUNT, or MUNT over MIDI)
 	switch (musicType) {
 	case MT_MT32:
-		_MT32       = true;
+		_nativeMT32 = true;
 		break;
 	case MT_GM:
 		if (ConfMan.getBool("native_mt32")) {
-			_MT32       = true;
+			_nativeMT32 = true;
 		}
 		break;
 	default:
@@ -134,7 +137,7 @@ int MidiDriver_Accolade_MT32::open() {
 	if (ret)
 		return ret;
 
-	if (_MT32)
+	if (_nativeMT32)
 		_driver->sendMT32Reset();
 	else
 		_driver->sendGMReset();
@@ -170,6 +173,11 @@ void MidiDriver_Accolade_MT32::send(uint32 b) {
 			// Figure out the requested instrument
 			byte midiInstrument = (b >> 8) & 0xFF;
 			byte mappedInstrument = _instrumentMapping[midiInstrument];
+
+			// If there is no actual MT32 (or MUNT), we make a second mapping to General MIDI instruments
+			if (!_nativeMT32) {
+				mappedInstrument = (MidiDriver::_mt32ToGm[mappedInstrument]);
+			}
 			// And replace it
 			b = (b & 0xFFFF00FF) | (mappedInstrument << 8);
 		}
diff --git a/engines/agos/midi.cpp b/engines/agos/midi.cpp
index 83c15fe..6048247 100644
--- a/engines/agos/midi.cpp
+++ b/engines/agos/midi.cpp
@@ -29,6 +29,8 @@
 
 #include "agos/drivers/accolade/mididriver.h"
 
+#include "gui/message.h"
+
 namespace AGOS {
 
 
@@ -114,12 +116,17 @@ int MidiPlayer::open(int gameType, bool isDemo) {
 		case MT_MT32:
 			break;
 		case MT_GM:
-			if (ConfMan.getBool("native_mt32")) {
-				// Real MT32
-				accoladeMusicType = MT_MT32;
-			} else {
-				_accoladeMode = false;
+			if (!ConfMan.getBool("native_mt32")) {
+				// Not a real MT32 / no MUNT
+				::GUI::MessageDialog dialog(("You appear to be using a General MIDI device,\n"
+											"but your game only supports Roland MT32 MIDI.\n"
+											"We try to map the Roland MT32 instruments to\n"
+											"General MIDI ones. It is still possible that\n"
+											"some tracks sound incorrect."));
+				dialog.runModal();
 			}
+			// Switch to MT32 driver in any case
+			accoladeMusicType = MT_MT32;
 			break;
 		default:
 			_accoladeMode = false;






More information about the Scummvm-git-logs mailing list