aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2015-05-31 23:28:28 +0200
committerMartin Kiewitz2015-05-31 23:28:28 +0200
commit90be81b284d1263bb8ebbd4dbf8f0ae41dec4ddc (patch)
treed916e1a26e7f72e08a95c3960157cae8ae0e04e9 /engines
parentf2bced65aca1e98bc75e4e2e6a5fd12eba95fcf3 (diff)
downloadscummvm-rg350-90be81b284d1263bb8ebbd4dbf8f0ae41dec4ddc.tar.gz
scummvm-rg350-90be81b284d1263bb8ebbd4dbf8f0ae41dec4ddc.tar.bz2
scummvm-rg350-90be81b284d1263bb8ebbd4dbf8f0ae41dec4ddc.zip
SHERLOCK: debug levels for AdLib & Music
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/music.cpp18
-rw-r--r--engines/sherlock/scalpel/drivers/adlib.cpp15
-rw-r--r--engines/sherlock/sherlock.cpp4
-rw-r--r--engines/sherlock/sherlock.h4
4 files changed, 22 insertions, 19 deletions
diff --git a/engines/sherlock/music.cpp b/engines/sherlock/music.cpp
index 0735f41d9a..ebfdc26aff 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 db1151c841..5411c74ce1 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 d3a409a67b..5ebf9e5166 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 e71c729893..078e9eab27 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 {