[Scummvm-cvs-logs] SF.net SVN: scummvm:[46467] scummvm/trunk/engines/sci/sfx

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Mon Dec 21 17:27:50 CET 2009


Revision: 46467
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46467&view=rev
Author:   thebluegr
Date:     2009-12-21 16:27:50 +0000 (Mon, 21 Dec 2009)

Log Message:
-----------
Some updates to the new music code

Modified Paths:
--------------
    scummvm/trunk/engines/sci/sfx/music.cpp
    scummvm/trunk/engines/sci/sfx/soundcmd.cpp

Modified: scummvm/trunk/engines/sci/sfx/music.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/music.cpp	2009-12-21 15:24:43 UTC (rev 46466)
+++ scummvm/trunk/engines/sci/sfx/music.cpp	2009-12-21 16:27:50 UTC (rev 46467)
@@ -66,6 +66,12 @@
 
 	_midiType = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB | MDT_PCSPK);
 
+	// Sanity check
+	if (_midiType != MDT_MIDI && _midiType != MDT_ADLIB && _midiType != MDT_PCSPK) {
+		warning("Unhandled MIDI type, switching to Adlib");
+		_midiType = MD_ADLIB;
+	}
+
 	switch (_midiType) {
 	case MD_ADLIB:
 		// FIXME: There's no Amiga sound option, so we hook it up to Adlib

Modified: scummvm/trunk/engines/sci/sfx/soundcmd.cpp
===================================================================
--- scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2009-12-21 15:24:43 UTC (rev 46466)
+++ scummvm/trunk/engines/sci/sfx/soundcmd.cpp	2009-12-21 16:27:50 UTC (rev 46467)
@@ -230,7 +230,8 @@
 	}
 
 	if (command < _soundCommands.size()) {
-		// printf("%s\n", _soundCommands[command]->desc);	// debug
+		//if (strcmp(_soundCommands[command]->desc, "cmdUpdateCues"))
+		//printf("%s\n", _soundCommands[command]->desc);	// debug
 		debugC(2, kDebugLevelSound, "%s", _soundCommands[command]->desc);
 		(this->*(_soundCommands[command]->sndCmd))(obj, value);
 	} else {
@@ -261,12 +262,9 @@
 		}
 	}
 
-#endif
-
 	if (!obj.segment || !_resMan->testResource(ResourceId(kResourceTypeSound, number)))
 		return;
 
-#ifdef USE_OLD_MUSIC_FUNCTIONS
 	_state->sfx_add_song(build_iterator(_resMan, number, type, handle), 0, handle, number);
 #endif
 
@@ -279,16 +277,20 @@
 
 #ifndef USE_OLD_MUSIC_FUNCTIONS
 	MusicEntry *newSound = new MusicEntry();
-	newSound->soundRes = new SoundResource(number, _resMan);
+	newSound->soundRes = 0;
+	if (_resMan->testResource(ResourceId(kResourceTypeSound, number)))
+		newSound->soundRes = new SoundResource(number, _resMan);
 	newSound->soundObj = obj;
 	newSound->prio = GET_SEL32V(_segMan, obj, pri) & 0xFF;
 	newSound->pStreamAud = 0;
 	newSound->pMidiParser = 0;
-	_music->_playList.push_back(newSound);
 
+	// TODO
 	//_music->soundKill(newSound);
+	_music->_playList.push_back(newSound);
 
-	_music->soundInitSnd(newSound);
+	if (newSound->soundRes)
+		_music->soundInitSnd(newSound);
 #endif
 }
 


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