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

bluegr bluegr at gmail.com
Mon Jun 15 02:16:19 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:
dd992772be SHERLOCK: RT: Initial implementation of XMI music support for RT


Commit: dd992772be489b69803c8d00fd66347fe16ad804
    https://github.com/scummvm/scummvm/commit/dd992772be489b69803c8d00fd66347fe16ad804
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2015-06-15T03:15:08+03:00

Commit Message:
SHERLOCK: RT: Initial implementation of XMI music support for RT

Changed paths:
    engines/sherlock/music.cpp
    engines/sherlock/music.h
    engines/sherlock/sound.cpp
    engines/sherlock/sound.h
    engines/sherlock/tattoo/tattoo_scene.cpp



diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp
index 470c6fa..29e122f 100644
--- a/engines/sherlock/music.cpp
+++ b/engines/sherlock/music.cpp
@@ -218,7 +218,7 @@ Music::Music(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
 	if (_vm->_interactiveFl)
 		_vm->_res->addToCache("MUSIC.LIB");
 
-	_midiParser = new MidiParser_SH();
+	_midiParser = (IS_SERRATED_SCALPEL) ? new MidiParser_SH() : MidiParser::createParser_XMIDI();
 
 	MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32);
 	_musicType = MidiDriver::getMusicType(dev);
@@ -320,8 +320,14 @@ bool Music::loadSong(int songNumber) {
 }
 
 bool Music::loadSong(const Common::String &songName) {
-	warning("TODO: Music::loadSong");
-	return false;
+	freeSong();  // free any song that is currently loaded
+	
+	if (!playMusic(songName))
+		return false;
+
+	stopMusic();
+	startSong();
+	return true;
 }
 
 void Music::syncMusicSettings() {
@@ -339,7 +345,7 @@ bool Music::playMusic(const Common::String &name) {
 		if (!_midiDriver)
 			return false;
 
-		Common::String midiMusicName = name + ".MUS";
+		Common::String midiMusicName = (IS_SERRATED_SCALPEL) ? name + ".MUS" : name + ".XMI";
 		Common::SeekableReadStream *stream = _vm->_res->load(midiMusicName, "MUSIC.LIB");
 
 		_midiMusicData = new byte[stream->size()];
@@ -365,17 +371,24 @@ bool Music::playMusic(const Common::String &name) {
 		byte *dataPos = _midiMusicData;
 		int32 dataSize = _midiMusicDataSize;
 
-		if (memcmp("            ", dataPos, 12)) {
-			warning("Music: expected header not found in music file");
-			return false;
-		}
-		dataPos += 12;
-		dataSize -= 12;
+		if (IS_SERRATED_SCALPEL) {
+			if (memcmp("            ", dataPos, 12)) {
+				warning("Music: expected header not found in music file");
+				return false;
+			}
+			dataPos += 12;
+			dataSize -= 12;
 
-		uint16 headerSize = READ_LE_UINT16(dataPos);
-		if (headerSize != 0x7F) {
-			warning("Music: header is not as expected");
-			return false;
+			uint16 headerSize = READ_LE_UINT16(dataPos);
+			if (headerSize != 0x7F) {
+				warning("Music: header is not as expected");
+				return false;
+			}
+		} else {
+			if (memcmp("FORM", dataPos, 4)) {
+				warning("Music: expected header not found in music file");
+				return false;
+			}
 		}
 
 		switch (_musicType) {
diff --git a/engines/sherlock/music.h b/engines/sherlock/music.h
index 2ebede9e..25270c4 100644
--- a/engines/sherlock/music.h
+++ b/engines/sherlock/music.h
@@ -58,7 +58,7 @@ class Music {
 private:
 	SherlockEngine *_vm;
 	Audio::Mixer *_mixer;
-	MidiParser_SH *_midiParser;
+	MidiParser *_midiParser;
 	MidiDriver *_midiDriver;
 	Audio::SoundHandle _digitalMusicHandle;
 	MusicType _musicType;
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index 795ccb0..70d42a7 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -60,7 +60,6 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
 	_soundIsOn = &_soundPlaying;
 	_curPriority = 0;
 	_digiBuf = nullptr;
-	_midiDrvLoaded = false;
 
 	_soundOn = true;
 	_speechOn = true;
diff --git a/engines/sherlock/sound.h b/engines/sherlock/sound.h
index 8514559..e82d94b 100644
--- a/engines/sherlock/sound.h
+++ b/engines/sherlock/sound.h
@@ -59,7 +59,6 @@ public:
 	bool _soundPlaying;
 	bool *_soundIsOn;
 	byte *_digiBuf;
-	bool _midiDrvLoaded;
 	Common::String _currentSongName, _nextSongName;
 public:
 	Sound(SherlockEngine *vm, Audio::Mixer *mixer);
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 1cc7b652..477739a 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -87,7 +87,7 @@ bool TattooScene::loadScene(const Common::String &filename) {
 	setNPCPath(0);
 
 	// Handle loading music for the scene
-	if (sound._midiDrvLoaded) {
+	if (music._musicOn) {
 		if (talk._scriptMoreFlag != 1 && talk._scriptMoreFlag != 3)
 			sound._nextSongName = Common::String::format("res%02d", _currentScene);
 






More information about the Scummvm-git-logs mailing list