diff --git a/engines/grim/debug.cpp b/engines/grim/debug.cpp index 6d3d8bd0c5a..61e6ee134ca 100644 --- a/engines/grim/debug.cpp +++ b/engines/grim/debug.cpp @@ -40,7 +40,7 @@ void Debug::registerDebugChannels() { DebugMan.addDebugChannel(Fonts, "fonts", ""); DebugMan.addDebugChannel(Keyframes, "keyframes", ""); DebugMan.addDebugChannel(Movie, "movie", ""); - DebugMan.addDebugChannel(Imuse, "imuse", ""); + DebugMan.addDebugChannel(Sound, "sound", ""); DebugMan.addDebugChannel(Scripts, "scripts", ""); DebugMan.addDebugChannel(Sets, "sets", ""); DebugMan.addDebugChannel(TextObjects, "textobjects", ""); diff --git a/engines/grim/debug.h b/engines/grim/debug.h index 094d88613d1..4acdc74e410 100644 --- a/engines/grim/debug.h +++ b/engines/grim/debug.h @@ -45,7 +45,7 @@ public: Keyframes = 2 << 10, Materials = 2 << 11, Movie = 2 << 12, - Imuse = 2 << 13, + Sound = 2 << 13, Scripts = 2 << 14, Sets = 2 << 15, TextObjects = 2 << 16, diff --git a/engines/grim/emi/lua_v2_sound.cpp b/engines/grim/emi/lua_v2_sound.cpp index b265fe37d13..d76484ccfa0 100644 --- a/engines/grim/emi/lua_v2_sound.cpp +++ b/engines/grim/emi/lua_v2_sound.cpp @@ -31,6 +31,7 @@ #include "engines/grim/emi/poolsound.h" #include "engines/grim/lua/lua.h" +#include "engines/grim/debug.h" #include "engines/grim/sound.h" #include "engines/grim/grim.h" #include "engines/grim/resource.h" @@ -49,7 +50,7 @@ void Lua_V2::ImGetMillisecondPosition() { // Currently a bit of guesswork, and probably wrong, as the stateId // is ignored by emisound (which only has one music-track now). uint32 msPos = g_sound->getMsPos(sound); - warning("Lua_V2::ImGetMillisecondPosition: sound: %d ms: %d", sound, msPos); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImGetMillisecondPosition: sound: %d ms: %d", sound, msPos); lua_pushnumber(msPos); } } @@ -91,7 +92,7 @@ void Lua_V2::SetReverb() { if (lua_isnumber(dampingObj)) damping = lua_getnumber(dampingObj); - warning("Lua_V2::SetReverb, eax: %d, decay: %f, mix: %f, predelay: %f, damping: %f", param, decay, mix, predelay, damping); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::SetReverb, eax: %d, decay: %f, mix: %f, predelay: %f, damping: %f", param, decay, mix, predelay, damping); // FIXME: func(param, decay, mix, predelay, damping); } @@ -102,7 +103,7 @@ void Lua_V2::ImSetState() { int state = (int)lua_getnumber(stateObj); g_imuseState = state; - warning("Lua_V2::ImSetState: stub, state: %d", state); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetState: stub, state: %d", state); } void Lua_V2::ImStateHasEnded() { @@ -115,7 +116,7 @@ void Lua_V2::ImStateHasEnded() { // FIXME: Make sure this logic is correct. pushbool(g_imuseState != state); - warning("Lua_V2::ImStateHasEnded: state %d.", state); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImStateHasEnded: state %d.", state); } // TODO: Implement this: @@ -137,7 +138,7 @@ void Lua_V2::EnableVoiceFX() { state = true; // FIXME: func(state); - warning("Lua_V2::EnableVoiceFX: implement opcode, state: %d", (int)state); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::EnableVoiceFX: implement opcode, state: %d", (int)state); } void Lua_V2::SetGroupVolume() { @@ -168,7 +169,7 @@ void Lua_V2::SetGroupVolume() { error("Lua_V2::SetGroupVolume - unknown group %d", group); } // FIXME: func(group, volume); - warning("Lua_V2::SetGroupVolume: group: %d, volume %d", group, volume); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::SetGroupVolume: group: %d, volume %d", group, volume); } void Lua_V2::EnableAudioGroup() { @@ -198,7 +199,7 @@ void Lua_V2::EnableAudioGroup() { error("Lua_V2::EnableAudioGroup - unknown group %d", group); } - warning("Lua_V2::EnableAudioGroup: group: %d, state %d", group, (int)state); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::EnableAudioGroup: group: %d, state %d", group, (int)state); } void Lua_V2::ImSelectSet() { @@ -208,13 +209,13 @@ void Lua_V2::ImSelectSet() { int quality = (int)lua_getnumber(qualityObj); // FIXME: func(quality); g_sound->selectMusicSet(quality); - warning("Lua_V2::ImSelectSet: quality mode: %d", quality); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSelectSet: quality mode: %d", quality); } } void Lua_V2::ImFlushStack() { // FIXME - warning("Lua_V2::ImFlushStack: currently guesswork"); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImFlushStack: currently guesswork"); g_sound->flushStack(); } @@ -398,7 +399,7 @@ void Lua_V2::PlaySound() { Common::SeekableReadStream *stream = g_resourceloader->openNewStreamFile(filename, true); if (!stream) { - warning("Lua_V2::PlaySound: Could not find sound '%s'", filename.c_str()); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::PlaySound: Could not find sound '%s'", filename.c_str()); return; } @@ -548,7 +549,7 @@ void Lua_V2::ImSetMusicVol() { if (!lua_isnumber(volumeObj)) return; int volume = (int)lua_getnumber(volumeObj); - warning("Lua_V2::ImSetMusicVol: implement opcode, wants volume %d", volume); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetMusicVol: implement opcode, wants volume %d", volume); } void Lua_V2::ImSetSfxVol() { @@ -558,7 +559,7 @@ void Lua_V2::ImSetSfxVol() { if (!lua_isnumber(volumeObj)) return; int volume = (int)lua_getnumber(volumeObj); - warning("Lua_V2::ImSetSfxVol: implement opcode, wants volume %d", volume); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetSfxVol: implement opcode, wants volume %d", volume); } void Lua_V2::ImSetVoiceVol() { @@ -568,7 +569,7 @@ void Lua_V2::ImSetVoiceVol() { if (!lua_isnumber(volumeObj)) return; int volume = (int)lua_getnumber(volumeObj); - warning("Lua_V2::ImSetVoiceVol: implement opcode, wants volume %d", volume); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetVoiceVol: implement opcode, wants volume %d", volume); } void Lua_V2::ImSetVoiceEffect() { @@ -579,20 +580,20 @@ void Lua_V2::ImSetVoiceEffect() { return; const char *str = lua_getstring(strObj); - warning("Lua_V2::ImSetVoiceEffect: implement opcode, wants effect %s", str); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImSetVoiceEffect: implement opcode, wants effect %s", str); } void Lua_V2::StopAllSounds() { - warning("Lua_V2::StopAllSounds: implement opcode"); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::StopAllSounds: implement opcode"); } void Lua_V2::ImPushState() { g_sound->pushState(); - warning("Lua_V2::ImPushState: currently guesswork"); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImPushState: currently guesswork"); } void Lua_V2::ImPopState() { g_sound->popState(); - warning("Lua_V2::ImPopState: currently guesswork"); + Debug::debug(Debug::Sound | Debug::Scripts, "Lua_V2::ImPopState: currently guesswork"); } } // end of namespace Grim diff --git a/engines/grim/emi/sound/aifftrack.cpp b/engines/grim/emi/sound/aifftrack.cpp index 81de24c9007..455eb94f12f 100644 --- a/engines/grim/emi/sound/aifftrack.cpp +++ b/engines/grim/emi/sound/aifftrack.cpp @@ -21,10 +21,10 @@ */ #include "common/mutex.h" -#include "common/textconsole.h" #include "audio/mixer.h" #include "audio/audiostream.h" #include "audio/decoders/aiff.h" +#include "engines/grim/debug.h" #include "engines/grim/resource.h" #include "engines/grim/emi/sound/aifftrack.h" @@ -43,7 +43,7 @@ AIFFTrack::~AIFFTrack() { bool AIFFTrack::openSound(const Common::String &soundName, Common::SeekableReadStream *file) { if (!file) { - warning("Stream for %s not open", soundName.c_str()); + Debug::debug(Debug::Sound, "Stream for %s not open", soundName.c_str()); return false; } _soundName = soundName; diff --git a/engines/grim/emi/sound/emisound.cpp b/engines/grim/emi/sound/emisound.cpp index 68ee77b6a68..7d3a59ab995 100644 --- a/engines/grim/emi/sound/emisound.cpp +++ b/engines/grim/emi/sound/emisound.cpp @@ -27,6 +27,7 @@ #include "audio/audiostream.h" #include "audio/decoders/raw.h" #include "audio/mixer.h" +#include "engines/grim/debug.h" #include "engines/grim/sound.h" #include "engines/grim/grim.h" #include "engines/grim/resource.h" @@ -181,16 +182,16 @@ void EMISound::setMusicState(int stateId) { if (stateId == 0) return; if (_musicTable == NULL) { - warning("No music table loaded"); + Debug::debug(Debug::Sound, "No music table loaded"); return; } if (_musicTable[stateId]._id != stateId) { - warning("Attempted to play track #%d, not found in music table!", stateId); + Debug::debug(Debug::Sound, "Attempted to play track #%d, not found in music table!", stateId); return; } Common::String filename; if (g_grim->getGamePlatform() == Common::kPlatformPS2) { - warning("PS2 doesn't have musictable yet %d ignored, just playing 1195.SCX", stateId); + Debug::debug(Debug::Sound, "PS2 doesn't have musictable yet %d ignored, just playing 1195.SCX", stateId); // So, we just rig up the menu-song hardcoded for now, as a test of the SCX-code. filename = "1195.SCX"; } else { @@ -199,7 +200,7 @@ void EMISound::setMusicState(int stateId) { _curMusicState = stateId; _music = createEmptyMusicTrack(); - warning("Loading music: %s", filename.c_str()); + Debug::debug(Debug::Sound, "Loading music: %s", filename.c_str()); if (initTrack(filename, _music)) { _music->play(); } diff --git a/engines/grim/emi/sound/mp3track.cpp b/engines/grim/emi/sound/mp3track.cpp index 7b6fc89724e..d5f1bf5048e 100644 --- a/engines/grim/emi/sound/mp3track.cpp +++ b/engines/grim/emi/sound/mp3track.cpp @@ -21,10 +21,10 @@ */ #include "common/mutex.h" -#include "common/textconsole.h" #include "audio/mixer.h" #include "audio/audiostream.h" #include "audio/decoders/mp3.h" +#include "engines/grim/debug.h" #include "engines/grim/resource.h" #include "engines/grim/emi/sound/mp3track.h" @@ -65,7 +65,7 @@ MP3Track::~MP3Track() { bool MP3Track::openSound(const Common::String &soundName, Common::SeekableReadStream *file) { if (!file) { - warning("Stream for %s not open", soundName.c_str()); + Debug::debug(Debug::Sound, "Stream for %s not open", soundName.c_str()); return false; } _soundName = soundName; diff --git a/engines/grim/emi/sound/vimatrack.cpp b/engines/grim/emi/sound/vimatrack.cpp index 8cda8791a94..055067e0c41 100644 --- a/engines/grim/emi/sound/vimatrack.cpp +++ b/engines/grim/emi/sound/vimatrack.cpp @@ -26,6 +26,7 @@ #include "audio/audiostream.h" #include "audio/mixer.h" #include "audio/decoders/raw.h" +#include "engines/grim/debug.h" #include "engines/grim/imuse/imuse_mcmp_mgr.h" #include "engines/grim/emi/sound/vimatrack.h" diff --git a/engines/grim/imuse/imuse.cpp b/engines/grim/imuse/imuse.cpp index ecd78d169a3..773b9867f87 100644 --- a/engines/grim/imuse/imuse.cpp +++ b/engines/grim/imuse/imuse.cpp @@ -327,7 +327,7 @@ void Imuse::switchToNextRegion(Track *track) { assert(track); if (track->trackId >= MAX_IMUSE_TRACKS) { - Debug::debug(Debug::Imuse, "Imuse::switchToNextRegion(): fadeTrack end: soundName:%s", track->soundName); + Debug::debug(Debug::Sound, "Imuse::switchToNextRegion(): fadeTrack end: soundName:%s", track->soundName); flushTrack(track); return; } @@ -335,7 +335,7 @@ void Imuse::switchToNextRegion(Track *track) { int numRegions = _sound->getNumRegions(track->soundDesc); if (++track->curRegion == numRegions) { - Debug::debug(Debug::Imuse, "Imuse::switchToNextRegion(): end of tracks: soundName:%s", track->soundName); + Debug::debug(Debug::Sound, "Imuse::switchToNextRegion(): end of tracks: soundName:%s", track->soundName); flushTrack(track); return; } @@ -348,7 +348,7 @@ void Imuse::switchToNextRegion(Track *track) { if (jumpId == -1 && track->curHookId != 128) jumpId = _sound->getJumpIdByRegionAndHookId(soundDesc, track->curRegion, 0); if (jumpId != -1) { - Debug::debug(Debug::Imuse, "Imuse::switchToNextRegion(): JUMP: soundName:%s", track->soundName); + Debug::debug(Debug::Sound, "Imuse::switchToNextRegion(): JUMP: soundName:%s", track->soundName); int region = _sound->getRegionIdByJumpId(soundDesc, jumpId); assert(region != -1); int sampleHookId = _sound->getJumpHookId(soundDesc, jumpId); @@ -369,7 +369,7 @@ void Imuse::switchToNextRegion(Track *track) { track->curHookId = 0; } - Debug::debug(Debug::Imuse, "Imuse::switchToNextRegion(): REGION %d: soundName:%s", (int)track->curRegion, track->soundName); + Debug::debug(Debug::Sound, "Imuse::switchToNextRegion(): REGION %d: soundName:%s", (int)track->curRegion, track->soundName); track->dataOffset = _sound->getRegionOffset(soundDesc, track->curRegion); track->regionOffset = 0; } diff --git a/engines/grim/imuse/imuse_music.cpp b/engines/grim/imuse/imuse_music.cpp index b37729d3b7c..e16eddd6af9 100644 --- a/engines/grim/imuse/imuse_music.cpp +++ b/engines/grim/imuse/imuse_music.cpp @@ -41,7 +41,7 @@ void Imuse::setMusicState(int stateId) { } assert(num != -1); - Debug::debug(Debug::Imuse, "Imuse::setMusicState(): SoundId %d, filename: %s", _stateMusicTable[l].soundId, _stateMusicTable[l].filename); + Debug::debug(Debug::Sound, "Imuse::setMusicState(): SoundId %d, filename: %s", _stateMusicTable[l].soundId, _stateMusicTable[l].filename); if (_curMusicState == num) return; @@ -71,7 +71,7 @@ int Imuse::setMusicSequence(int seqId) { assert(num != -1); - Debug::debug(Debug::Imuse, "Imuse::setMusicSequence(): SoundId %d, filename: %s", _seqMusicTable[l].soundId, _seqMusicTable[l].filename); + Debug::debug(Debug::Sound, "Imuse::setMusicSequence(): SoundId %d, filename: %s", _seqMusicTable[l].soundId, _seqMusicTable[l].filename); if (_curMusicSeq == num) return _seqMusicTable[_curMusicSeq].soundId; diff --git a/engines/grim/imuse/imuse_script.cpp b/engines/grim/imuse/imuse_script.cpp index 1c0fbaa48d0..9b8abcc9a46 100644 --- a/engines/grim/imuse/imuse_script.cpp +++ b/engines/grim/imuse/imuse_script.cpp @@ -76,22 +76,22 @@ void Imuse::refreshScripts() { } bool Imuse::startVoice(const char *soundName, int volume, int pan) { - Debug::debug(Debug::Imuse, "Imuse::startVoice(): SoundName %s, vol:%d, pan:%d", soundName, volume, pan); + Debug::debug(Debug::Sound, "Imuse::startVoice(): SoundName %s, vol:%d, pan:%d", soundName, volume, pan); return startSound(soundName, IMUSE_VOLGRP_VOICE, 0, volume, pan, 127, NULL); } void Imuse::startMusic(const char *soundName, int hookId, int volume, int pan) { - Debug::debug(Debug::Imuse, "Imuse::startMusic(): SoundName %s, hookId:%d, vol:%d, pan:%d", soundName, hookId, volume, pan); + Debug::debug(Debug::Sound, "Imuse::startMusic(): SoundName %s, hookId:%d, vol:%d, pan:%d", soundName, hookId, volume, pan); startSound(soundName, IMUSE_VOLGRP_MUSIC, hookId, volume, pan, 126, NULL); } void Imuse::startMusicWithOtherPos(const char *soundName, int hookId, int volume, int pan, Track *otherTrack) { - Debug::debug(Debug::Imuse, "Imuse::startMusicWithOtherPos(): SoundName %s, hookId:%d, vol:%d, pan:%d", soundName, hookId, volume, pan); + Debug::debug(Debug::Sound, "Imuse::startMusicWithOtherPos(): SoundName %s, hookId:%d, vol:%d, pan:%d", soundName, hookId, volume, pan); startSound(soundName, IMUSE_VOLGRP_MUSIC, hookId, volume, pan, 126, otherTrack); } void Imuse::startSfx(const char *soundName, int priority) { - Debug::debug(Debug::Imuse, "Imuse::startSfx(): SoundName %s, priority:%d", soundName, priority); + Debug::debug(Debug::Sound, "Imuse::startSfx(): SoundName %s, priority:%d", soundName, priority); startSound(soundName, IMUSE_VOLGRP_SFX, 0, 127, 0, priority, NULL); } @@ -102,7 +102,7 @@ int32 Imuse::getPosIn16msTicks(const char *soundName) { getTrack = findTrack(soundName); // Warn the user if the track was not found if (getTrack == NULL) { - Debug::warning(Debug::Imuse, "Sound '%s' could not be found to get ticks", soundName); + Debug::warning(Debug::Sound, "Sound '%s' could not be found to get ticks", soundName); return false; } @@ -136,7 +136,7 @@ bool Imuse::getSoundStatus(const char *soundName) { if (track == NULL || !g_system->getMixer()->isSoundHandleActive(track->handle)) { // This debug warning should be "light" since this function gets called // on occassion to see if a sound has stopped yet - Debug::debug(Debug::Imuse, "Sound '%s' could not be found to get status, assume inactive.", soundName); + Debug::debug(Debug::Sound, "Sound '%s' could not be found to get status, assume inactive.", soundName); return false; } return true; @@ -144,13 +144,13 @@ bool Imuse::getSoundStatus(const char *soundName) { void Imuse::stopSound(const char *soundName) { Common::StackLock lock(_mutex); - Debug::debug(Debug::Imuse, "Imuse::stopSound(): SoundName %s", soundName); + Debug::debug(Debug::Sound, "Imuse::stopSound(): SoundName %s", soundName); Track *removeTrack = NULL; removeTrack = findTrack(soundName); // Warn the user if the track was not found if (removeTrack == NULL) { - Debug::warning(Debug::Imuse, "Sound track '%s' could not be found to stop", soundName); + Debug::warning(Debug::Sound, "Sound track '%s' could not be found to stop", soundName); return; } flushTrack(removeTrack); @@ -158,7 +158,7 @@ void Imuse::stopSound(const char *soundName) { void Imuse::stopAllSounds() { Common::StackLock lock(_mutex); - Debug::debug(Debug::Imuse, "Imuse::stopAllSounds()"); + Debug::debug(Debug::Sound, "Imuse::stopAllSounds()"); for (int l = 0; l < MAX_IMUSE_TRACKS + MAX_IMUSE_FADETRACKS; l++) { Track *track = _track[l]; diff --git a/engines/grim/imuse/imuse_track.cpp b/engines/grim/imuse/imuse_track.cpp index f767f698d2f..882808f9422 100644 --- a/engines/grim/imuse/imuse_track.cpp +++ b/engines/grim/imuse/imuse_track.cpp @@ -105,7 +105,7 @@ bool Imuse::startSound(const char *soundName, int volGroupId, int hookId, int vo for (i = 0; i < MAX_IMUSE_TRACKS; i++) { // Filenames are case insensitive, see findTrack if (!scumm_stricmp(_track[i]->soundName, soundName)) { - Debug::debug(Debug::Imuse, "Imuse::startSound(): Track '%s' already playing.", soundName); + Debug::debug(Debug::Sound, "Imuse::startSound(): Track '%s' already playing.", soundName); return true; } } diff --git a/engines/grim/lua_v1_sound.cpp b/engines/grim/lua_v1_sound.cpp index 34c128aa03a..d8e63b1da3a 100644 --- a/engines/grim/lua_v1_sound.cpp +++ b/engines/grim/lua_v1_sound.cpp @@ -92,7 +92,7 @@ void Lua_V1::ImSetVoiceEffect() { const char *effectName; effectName = luaL_check_string(1); - Debug::warning(Debug::Imuse, "ImSetVoiceEffect(%s) Voice effects are not yet supported", effectName); + Debug::warning(Debug::Sound, "ImSetVoiceEffect(%s) Voice effects are not yet supported", effectName); } void Lua_V1::ImSetMusicVol() {