[Scummvm-cvs-logs] CVS: scummvm/saga music.cpp,1.26,1.27 music.h,1.10,1.11 saga.cpp,1.54,1.55

Eugene Sandulenko sev at users.sourceforge.net
Thu Oct 21 15:47:06 CEST 2004


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

Modified Files:
	music.cpp music.h saga.cpp 
Log Message:
Better support of MT-32.


Index: music.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/music.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- music.cpp	16 Oct 2004 07:46:04 -0000	1.26
+++ music.cpp	21 Oct 2004 22:40:06 -0000	1.27
@@ -230,6 +230,11 @@
 }
 
 void MusicPlayer::send(uint32 b) {
+	if (_passThrough) {
+		_driver->send(b);
+		return;
+	}
+
 	byte channel = (byte)(b & 0x0F);
 	if ((b & 0xFFF0) == 0x07B0) {
 		// Adjust volume changes by master volume

Index: music.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/music.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- music.h	12 Oct 2004 11:45:53 -0000	1.10
+++ music.h	21 Oct 2004 22:40:06 -0000	1.11
@@ -59,6 +59,7 @@
 	void playMusic();
 	void stopMusic();
 	void setLoop(bool loop) { _looping = loop; }
+	void setPassThrough(bool b)		{ _passThrough = b; }
 
 	void setGM(bool isGM) { _isGM = isGM; }
 
@@ -87,6 +88,7 @@
 	byte _channelVolume[16];
 	bool _nativeMT32;
 	bool _isGM;
+	bool _passThrough;
 
 	bool _isPlaying;
 	bool _looping;
@@ -104,6 +106,7 @@
 	Music(SoundMixer *mixer, MidiDriver *driver, int enabled);
 	~Music(void);
 	void hasNativeMT32(bool b)		{ _player->hasNativeMT32(b); }
+	void setPassThrough(bool b)		{ _player->setPassThrough(b); }
 
 	int play(uint32 music_rn, uint16 flags = R_MUSIC_DEFAULT);
 	int pause(void);

Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- saga.cpp	12 Oct 2004 11:45:53 -0000	1.54
+++ saga.cpp	21 Oct 2004 22:40:06 -0000	1.55
@@ -161,27 +161,31 @@
 
 	_previousTicks = _system->getMillis();
 
-	// On some platforms, graphics initialization also initializes sound
-	// ( Win32 DirectX )... Music must be initialized before sound for 
-	// native midi support
-	MidiDriver *driver = GameDetector::createMidi(GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE));
+	// Initialize graphics
+	R_GAME_DISPLAYINFO disp_info;
+	GAME_GetDisplayInfo(&disp_info);
+	_gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h);
+
+	// Graphics should be initialized before music
+	int midiDriver = GameDetector::detectMusicDriver(MDT_NATIVE | MDT_ADLIB | MDT_PREFER_NATIVE);
+	bool native_mt32 = (ConfMan.getBool("native_mt32") || (midiDriver == MD_MT32));
+
+	MidiDriver *driver = GameDetector::createMidi(midiDriver);
 	if (!driver)
 		driver = MidiDriver_ADLIB_create(_mixer);
-	else if (ConfMan.getBool("native_mt32"))
+	else if (native_mt32)
 		driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE);
 
 	_music = new Music(_mixer, driver, _musicEnabled);
-	_music->hasNativeMT32(ConfMan.getBool("native_mt32"));
+	_music->hasNativeMT32(native_mt32);
+
+	if (midiDriver == MD_MT32)
+		_music->setPassThrough(true);
 
 	if (!_musicEnabled) {
 		debug(0, "Music disabled.");
 	}
 
-	// Initialize graphics
-	R_GAME_DISPLAYINFO disp_info;
-	GAME_GetDisplayInfo(&disp_info);
-	_gfx = new Gfx(_system, disp_info.logical_w, disp_info.logical_h);
-
 	_isoMap = new IsoMap(_gfx);
 	
 	_render = new Render(this, _system);





More information about the Scummvm-git-logs mailing list