[Scummvm-cvs-logs] scummvm master -> b6cf04bb0e4e511ffa795ee1cb8a11c70169500d

m-kiewitz m_kiewitz at users.sourceforge.net
Wed Jul 1 01:30:47 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:
b6cf04bb0e AMAZON: implement proper AdLib support (Miles)


Commit: b6cf04bb0e4e511ffa795ee1cb8a11c70169500d
    https://github.com/scummvm/scummvm/commit/b6cf04bb0e4e511ffa795ee1cb8a11c70169500d
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-07-01T01:30:12+02:00

Commit Message:
AMAZON: implement proper AdLib support (Miles)

implement proper AdLib support
game uses MIDPAK, which seems to be basically Miles Audio too
instrument data was hidden inside MIDIDRV.AP
thanks to dreammaster for extracting the files

Changed paths:
    engines/access/sound.cpp



diff --git a/engines/access/sound.cpp b/engines/access/sound.cpp
index da267bd..89fd4fe 100644
--- a/engines/access/sound.cpp
+++ b/engines/access/sound.cpp
@@ -21,9 +21,12 @@
  */
 
 #include "common/algorithm.h"
+#include "common/config-manager.h"
 #include "audio/mixer.h"
 #include "audio/decoders/raw.h"
 #include "audio/decoders/wave.h"
+// Miles Audio
+#include "audio/miles.h"
 #include "access/access.h"
 #include "access/sound.h"
 
@@ -194,9 +197,41 @@ MusicManager::MusicManager(AccessEngine *vm) : _vm(vm) {
 	_music = nullptr;
 	_tempMusic = nullptr;
 	_isLooping = false;
+	_driver = nullptr;
 
+	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32);
+	MusicType musicType = MidiDriver::getMusicType(dev);
+
+	// Amazon Guardians of Eden uses MIDPAK inside MIDIDRV.AP
+	// Amazon Guardians of Eden possibly used MIDPAK as well
+	// AdLib patches are inside MIDIDRV.AP too, 2nd resource file
+	switch (musicType) {
+	case MT_ADLIB: {
+		Resource   *midiDrvResource = _vm->_files->loadFile(92, 1);
+		const byte *adLibInstrumentData = midiDrvResource->data();
+		uint32      adLibInstrumentDataSize = midiDrvResource->_size;
+
+		_driver = Audio::MidiDriver_Miles_AdLib_create("", "", adLibInstrumentData, adLibInstrumentDataSize);
+
+		delete midiDrvResource;
+		break;
+	}
+	case MT_MT32:
+		_driver = Audio::MidiDriver_Miles_MT32_create("");
+		_nativeMT32 = true;
+		break;
+	case MT_GM:
+		if (ConfMan.getBool("native_mt32")) {
+			_driver = Audio::MidiDriver_Miles_MT32_create("");
+			_nativeMT32 = true;
+		}
+		break;
+	}
+
+#if 0
 	MidiPlayer::createDriver();
 	MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_GM);
+#endif
 
 	int retValue = _driver->open();
 	if (retValue == 0) {
@@ -215,11 +250,15 @@ MusicManager::~MusicManager() {
 }
 
 void MusicManager::send(uint32 b) {
+	// Pass data directly to driver
+	_driver->send(b);
+#if 0
 	if ((b & 0xF0) == 0xC0 && !_nativeMT32) {
 		b = (b & 0xFFFF00FF) | MidiDriver::_mt32ToGm[(b >> 8) & 0xFF] << 8;
 	}
 
 	Audio::MidiPlayer::send(b);
+#endif
 }
 
 void MusicManager::midiPlay() {






More information about the Scummvm-git-logs mailing list