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

m-kiewitz m_kiewitz at users.sourceforge.net
Sun May 31 23:29:15 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:
f2ffaf427f SHERLOCK: debug levels for AdLib & Music


Commit: f2ffaf427f07b11d76d0c27b73d71228d0b47374
    https://github.com/scummvm/scummvm/commit/f2ffaf427f07b11d76d0c27b73d71228d0b47374
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-05-31T23:28:28+02:00

Commit Message:
SHERLOCK: debug levels for AdLib & Music

Changed paths:
    engines/sherlock/music.cpp
    engines/sherlock/scalpel/drivers/adlib.cpp
    engines/sherlock/sherlock.cpp
    engines/sherlock/sherlock.h



diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp
index 0735f41..ebfdc26 100644
--- a/engines/sherlock/music.cpp
+++ b/engines/sherlock/music.cpp
@@ -151,16 +151,16 @@ void MidiParser_SH::parseNextEvent(EventInfo &info) {
 			}
 		} else if (info.event == 0xFC) {
 			// Official End-Of-Track signal
-			warning("System META event 0xFC");
+			debugC(kDebugLevelMusic, "Music: System META event 0xFC");
 
 			byte type = *(_position._playPos++);
 			switch (type) {
 			case 0x80: // end of track, triggers looping
-				warning("META event triggered looping");
+				debugC(kDebugLevelMusic, "Music: META event triggered looping");
 				jumpToTick(0, true, true, false);
 				break;
 			case 0x81: // end of track, stop playing
-				warning("META event triggered music stop");
+				debugC(kDebugLevelMusic, "Music: META event triggered music stop");
 				stopPlaying();
 				unloadMusic();
 				break;
@@ -180,7 +180,7 @@ void MidiParser_SH::parseNextEvent(EventInfo &info) {
 }
 
 bool MidiParser_SH::loadMusic(byte *data, uint32 size) {
-	warning("loadMusic");
+	debugC(kDebugLevelMusic, "Music: loadMusic()");
 	unloadMusic();
 
 	byte  *headerPtr  = data;
@@ -242,7 +242,7 @@ Music::Music(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
 }
 
 bool Music::loadSong(int songNumber) {
-	warning("loadSong");
+	debugC(kDebugLevelMusic, "Music: loadSong()");
 
 	if(songNumber == 100)
 		songNumber = 55;
@@ -285,7 +285,7 @@ bool Music::playMusic(const Common::String &name) {
 	if (!_musicOn)
 		return false;
 
-	warning("Sound::playMusic %s", name.c_str());
+	debugC(kDebugLevelMusic, "Music: playMusic('%s')", name.c_str());
 	Common::SeekableReadStream *stream = _vm->_res->load(name, "MUSIC.LIB");
 
 	byte *data = new byte[stream->size()];
@@ -305,13 +305,13 @@ bool Music::playMusic(const Common::String &name) {
 #endif
 
 	if (dataSize < 14) {
-		warning("not enough data in music file");
+		warning("Music: not enough data in music file");
 		return false;
 	}
 
 	byte *dataPos = data;
 	if (memcmp("            ", dataPos, 12)) {
-		warning("Expected header not found in music file");
+		warning("Music: expected header not found in music file");
 		return false;
 	}
 	dataPos += 12;
@@ -319,7 +319,7 @@ bool Music::playMusic(const Common::String &name) {
 
 	uint16 headerSize = READ_LE_UINT16(dataPos);
 	if (headerSize != 0x7F) {
-		warning("music header is not as expected");
+		warning("Music: header is not as expected");
 		return false;
 	}
 
diff --git a/engines/sherlock/scalpel/drivers/adlib.cpp b/engines/sherlock/scalpel/drivers/adlib.cpp
index db1151c..5411c74 100644
--- a/engines/sherlock/scalpel/drivers/adlib.cpp
+++ b/engines/sherlock/scalpel/drivers/adlib.cpp
@@ -287,7 +287,7 @@ private:
 int MidiDriver_AdLib::open() {
 	int rate = _mixer->getOutputRate();
 
-	debug(3, "ADLIB: Starting driver");
+	debugC(kDebugLevelAdLibDriver, "AdLib: starting driver");
 
 	_opl = OPL::Config::create(OPL::Config::kOpl2);
 
@@ -406,11 +406,11 @@ void MidiDriver_AdLib::send(uint32 b) {
 		// Aftertouch doesn't seem to be implemented in the Sherlock Holmes adlib driver
 		break;
 	case 0xe0:
-		warning("pitch bend change");
+		debugC(kDebugLevelAdLibDriver, "AdLib: pitch bend change");
 		pitchBendChange(channel, op1, op2);
 		break;
 	case 0xf0: // SysEx
-		warning("SysEx: %x", b);
+		warning("ADLIB: SysEx: %x", b);
 		break;
 	default:
 		warning("ADLIB: Unknown event %02x", command);
@@ -453,7 +453,7 @@ void MidiDriver_AdLib::noteOn(byte MIDIchannel, byte note, byte velocity) {
 		}
 		if (oldestInUseChannel >= 0) {
 			// channel found
-			warning("used In-Use channel");
+			debugC(kDebugLevelAdLibDriver, "AdLib: used In-Use channel");
 			// original driver used note 0, we use the current note
 			// because using note 0 could create a bad note (out of index) and we check that. Original driver didn't.
 			voiceOnOff(oldestInUseChannel, false, _channels[oldestInUseChannel].currentNote, 0);
@@ -464,11 +464,10 @@ void MidiDriver_AdLib::noteOn(byte MIDIchannel, byte note, byte velocity) {
 			voiceOnOff(oldestInUseChannel, true, note, velocity);
 			return;
 		}
-		warning("MIDI channel not mapped/all FM voice channels busy %d", MIDIchannel);
+		debugC(kDebugLevelAdLibDriver, "AdLib: MIDI channel not mapped/all FM voice channels busy %d", MIDIchannel);
 
 	} else {
 		// Percussion channel
-		warning("percussion!");
 		for (byte FMvoiceChannel = 0; FMvoiceChannel < SHERLOCK_ADLIB_VOICES_COUNT; FMvoiceChannel++) {
 			if (_voiceChannelMapping[FMvoiceChannel] == MIDIchannel) {
 				if (note == adlib_percussionChannelTable[FMvoiceChannel].requiredNote) {
@@ -480,7 +479,7 @@ void MidiDriver_AdLib::noteOn(byte MIDIchannel, byte note, byte velocity) {
 				}
 			}
 		}
-		warning("percussion MIDI channel not mapped/all FM voice channels busy");
+		debugC(kDebugLevelAdLibDriver, "AdLib: percussion MIDI channel not mapped/all FM voice channels busy");
 	}
 }
 
@@ -519,7 +518,7 @@ void MidiDriver_AdLib::voiceOnOff(byte FMvoiceChannel, bool keyOn, byte note, by
 		frequencyOffset = note;
 	}
 	if (frequencyOffset >= SHERLOCK_ADLIB_NOTES_COUNT) {
-		warning("CRITICAL - bad note!!!");
+		warning("CRITICAL - AdLib driver: bad note!!!");
 		return;
 	}
 	frequency = adlib_FrequencyLookUpTable[frequencyOffset];
diff --git a/engines/sherlock/sherlock.cpp b/engines/sherlock/sherlock.cpp
index d3a409a..5ebf9e5 100644
--- a/engines/sherlock/sherlock.cpp
+++ b/engines/sherlock/sherlock.cpp
@@ -71,7 +71,9 @@ SherlockEngine::~SherlockEngine() {
 }
 
 void SherlockEngine::initialize() {
-	DebugMan.addDebugChannel(kDebugScript, "scripts", "Script debug level");
+	DebugMan.addDebugChannel(kDebugLevelScript,      "scripts", "Script debug level");
+	DebugMan.addDebugChannel(kDebugLevelAdLibDriver, "AdLib",   "AdLib driver debugging");
+	DebugMan.addDebugChannel(kDebugLevelMusic,       "Music",   "Music debugging");
 
 	ImageFile::setVm(this);
 	Object::setVm(this);
diff --git a/engines/sherlock/sherlock.h b/engines/sherlock/sherlock.h
index e71c729..078e9ea 100644
--- a/engines/sherlock/sherlock.h
+++ b/engines/sherlock/sherlock.h
@@ -51,7 +51,9 @@
 namespace Sherlock {
 
 enum {
-	kDebugScript = 1 << 0
+	kDebugLevelScript      = 1 << 0,
+	kDebugLevelAdLibDriver = 2 << 0,
+	kDebugLevelMusic       = 3 << 0,
 };
 
 enum GameType {






More information about the Scummvm-git-logs mailing list