[Scummvm-cvs-logs] SF.net SVN: scummvm: [27158] scummvm/trunk/engines/agos

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Thu Jun 7 04:43:05 CEST 2007


Revision: 27158
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27158&view=rev
Author:   Kirben
Date:     2007-06-06 19:43:03 -0700 (Wed, 06 Jun 2007)

Log Message:
-----------
Limit MIDI driver, to games using MIDI music only.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.cpp
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/input.cpp
    scummvm/trunk/engines/agos/res_snd.cpp

Modified: scummvm/trunk/engines/agos/agos.cpp
===================================================================
--- scummvm/trunk/engines/agos/agos.cpp	2007-06-07 01:55:16 UTC (rev 27157)
+++ scummvm/trunk/engines/agos/agos.cpp	2007-06-07 02:43:03 UTC (rev 27158)
@@ -318,7 +318,6 @@
 	_scrollUpHitArea = 0;
 	_scrollDownHitArea = 0;
 
-
 	_noOverWrite = 0;
 	_rejectBlock = false;
 
@@ -472,6 +471,9 @@
 
 	_planarBuf = 0;
 
+	_midiEnabled = false;
+	_nativeMT32 = false;
+
 	_vgaTickCounter = 0;
 
 	_moviePlay = 0;
@@ -572,31 +574,34 @@
 	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
 	_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
 
-	// Setup midi driver
-	MidiDriver *driver = 0;
-	if (getGameType() == GType_FF || getGameType() == GType_PP || getGameId() == GID_SIMON1CD32) {
-		driver = MidiDriver::createMidi(MD_NULL);
-		_native_mt32 = false;
-	} else {
+	if ((getGameType() == GType_SIMON2 && getPlatform() == Common::kPlatformWindows) ||
+		(getGameType() == GType_SIMON1 && getPlatform() == Common::kPlatformWindows) ||
+		((getFeatures() & GF_TALKIE) && getPlatform() == Common::kPlatformAcorn) ||
+		(getPlatform() == Common::kPlatformPC)) {
+
+		// Setup midi driver
 		int midiDriver = MidiDriver::detectMusicDriver(MDT_ADLIB | MDT_MIDI);
-		_native_mt32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
-		driver = MidiDriver::createMidi(midiDriver);
-		if (_native_mt32) {
+		_nativeMT32 = ((midiDriver == MD_MT32) || ConfMan.getBool("native_mt32"));
+		MidiDriver *driver = MidiDriver::createMidi(midiDriver);
+		if (_nativeMT32) {
 			driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
 		}
-	}
 
-	_midi.mapMT32toGM (getGameType() != GType_SIMON2 && !_native_mt32);
+		_midi.mapMT32toGM (getGameType() != GType_SIMON2 && !_nativeMT32);
 
-	_midi.setDriver(driver);
-	int ret = _midi.open();
-	if (ret)
-		warning("MIDI Player init failed: \"%s\"", _midi.getErrorName (ret));
-	_midi.setVolume(ConfMan.getInt("music_volume"));
+		_midi.setDriver(driver);
+		int ret = _midi.open();
+		if (ret)
+			warning("MIDI Player init failed: \"%s\"", _midi.getErrorName (ret));
 
-	if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
-		_midi.pause(_musicPaused ^= 1);
+		_midi.setVolume(ConfMan.getInt("music_volume"));
 
+		if (ConfMan.hasKey("music_mute") && ConfMan.getBool("music_mute") == 1)
+			_midi.pause(_musicPaused ^= 1);
+
+		_midiEnabled = true;
+	}
+
 	// allocate buffers
 	_backGroundBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
 	_frontBuf = (byte *)calloc(_screenWidth * _screenHeight, 1);
@@ -742,7 +747,7 @@
 	_itemMemSize = 20000;
 	_tableMemSize = 100000;
 	// Check whether to use MT-32 MIDI tracks in Simon the Sorcerer 2
-	if ((getGameType() == GType_SIMON2) && _native_mt32)
+	if ((getGameType() == GType_SIMON2) && _nativeMT32)
 		_musicIndexBase = (1128 + 612) / 4;
 	else
 		_musicIndexBase = 1128 / 4;

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2007-06-07 01:55:16 UTC (rev 27157)
+++ scummvm/trunk/engines/agos/agos.h	2007-06-07 02:43:03 UTC (rev 27158)
@@ -517,7 +517,8 @@
 	byte _lettersToPrintBuf[80];
 
 	MidiPlayer _midi;
-	bool _native_mt32;
+	bool _midiEnabled;
+	bool _nativeMT32;
 
 	int _vgaTickCounter;
 

Modified: scummvm/trunk/engines/agos/input.cpp
===================================================================
--- scummvm/trunk/engines/agos/input.cpp	2007-06-07 01:55:16 UTC (rev 27157)
+++ scummvm/trunk/engines/agos/input.cpp	2007-06-07 02:43:03 UTC (rev 27158)
@@ -558,26 +558,22 @@
 				_speech ^= 1;
 		}
 	case '+':
-		if ((getPlatform() == Common::kPlatformAcorn && (getFeatures() & GF_TALKIE)) ||
-			getPlatform() == Common::kPlatformPC || getPlatform() == Common::kPlatformWindows) {
+		if (_midiEnabled) {
 			_midi.setVolume(_midi.getVolume() + 16);
 		}
 		_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) + 16);
 		break;
 	case '-':
-		if ((getPlatform() == Common::kPlatformAcorn && (getFeatures() & GF_TALKIE)) ||
-			getPlatform() == Common::kPlatformPC || getPlatform() == Common::kPlatformWindows) {
+		if (_midiEnabled) {
 			_midi.setVolume(_midi.getVolume() - 16);
 		}
 		_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) - 16);
 		break;
 	case 'm':
-		if ((getPlatform() == Common::kPlatformAcorn && (getFeatures() & GF_TALKIE)) ||
-			getPlatform() == Common::kPlatformPC || getPlatform() == Common::kPlatformWindows) {
+		if (_midiEnabled) {
 			_midi.pause(_musicPaused ^= 1);
-		} else {
-			// TODO
 		}
+		// TODO
 		break;
 	case 's':
 		if (getGameId() == GID_SIMON1DOS) {

Modified: scummvm/trunk/engines/agos/res_snd.cpp
===================================================================
--- scummvm/trunk/engines/agos/res_snd.cpp	2007-06-07 01:55:16 UTC (rev 27157)
+++ scummvm/trunk/engines/agos/res_snd.cpp	2007-06-07 02:43:03 UTC (rev 27158)
@@ -259,12 +259,10 @@
 }
 
 void AGOSEngine::stopMusic() {
-	if ((getPlatform() == Common::kPlatformAcorn && (getFeatures() & GF_TALKIE)) ||
-		getPlatform() == Common::kPlatformPC || getPlatform() == Common::kPlatformWindows) {
+	if (_midiEnabled) {
 		_midi.stop();
-	} else {
-		_mixer->stopHandle(_modHandle);
-	}
+	} 
+	_mixer->stopHandle(_modHandle);
 }
 
 void AGOSEngine::playSting(uint a) {


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