From 4c3421288d2d74396579f35b25a7b78e14afa7f4 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Sun, 22 Jul 2012 22:29:07 +0200 Subject: WINTERMUTE: Add an audio-debug-channel and reduce the use of warning() --- engines/wintermute/base/base_file_manager.cpp | 2 +- engines/wintermute/base/sound/base_sound_buffer.cpp | 13 ++++--------- engines/wintermute/wintermute.cpp | 1 + engines/wintermute/wintermute.h | 3 ++- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/engines/wintermute/base/base_file_manager.cpp b/engines/wintermute/base/base_file_manager.cpp index f651835fe4..0a59a3b134 100644 --- a/engines/wintermute/base/base_file_manager.cpp +++ b/engines/wintermute/base/base_file_manager.cpp @@ -472,7 +472,7 @@ bool BaseFileManager::registerPackage(Common::SeekableReadStream *package, const ((byte *)name)[k] ^= 'D'; } } - + debugC(kWinterMuteDebugFileAccess, "Package contains %s", name); // some old version of ProjectMan writes invalid directory entries // so at least prevent strupr from corrupting memory name[nameLength - 1] = '\0'; diff --git a/engines/wintermute/base/sound/base_sound_buffer.cpp b/engines/wintermute/base/sound/base_sound_buffer.cpp index b8c19c2985..e1dba2120d 100644 --- a/engines/wintermute/base/sound/base_sound_buffer.cpp +++ b/engines/wintermute/base/sound/base_sound_buffer.cpp @@ -33,6 +33,7 @@ #include "engines/wintermute/base/sound/base_sound_buffer.h" #include "engines/wintermute/base/base_file_manager.h" #include "engines/wintermute/utils/utils.h" +#include "engines/wintermute/wintermute.h" #include "audio/audiostream.h" #include "audio/mixer.h" #include "audio/decoders/vorbis.h" @@ -95,13 +96,7 @@ void BaseSoundBuffer::setStreaming(bool Streamed, uint32 NumBlocks, uint32 Block ////////////////////////////////////////////////////////////////////////// bool BaseSoundBuffer::loadFromFile(const char *filename, bool forceReload) { - warning("BSoundBuffer::LoadFromFile(%s,%d)", filename, forceReload); -#if 0 - if (_stream) { - BASS_StreamFree(_stream); - _stream = NULL; - } -#endif + debugC(kWinterMuteDebugAudio, "BSoundBuffer::LoadFromFile(%s,%d)", filename, forceReload); // Load a file, but avoid having the File-manager handle the disposal of it. _file = _gameRef->_fileManager->openFile(filename, true, false); @@ -123,11 +118,11 @@ bool BaseSoundBuffer::loadFromFile(const char *filename, bool forceReload) { _file = new Common::SeekableSubReadStream(_file, 0, waveSize); _stream = Audio::makeRawStream(_file, waveRate, waveFlags, DisposeAfterUse::YES); } else { - warning("BSoundBuffer::LoadFromFile - WAVE not supported yet for %s with type %d", filename, waveType); + error("BSoundBuffer::LoadFromFile - WAVE not supported yet for %s with type %d", filename, waveType); } } } else { - warning("BSoundBuffer::LoadFromFile - Unknown filetype for %s", filename); + error("BSoundBuffer::LoadFromFile - Unknown filetype for %s", filename); } if (!_stream) { return STATUS_FAILED; diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 9040de66e6..520889fd11 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -73,6 +73,7 @@ WinterMuteEngine::WinterMuteEngine(OSystem *syst, const ADGameDescription *desc) DebugMan.addDebugChannel(kWinterMuteDebugSaveGame, "savegame", "Savegames"); DebugMan.addDebugChannel(kWinterMuteDebugFont, "font", "Text-drawing-related messages"); DebugMan.addDebugChannel(kWinterMuteDebugFileAccess, "file-access", "Non-critical problems like missing files"); + DebugMan.addDebugChannel(kWinterMuteDebugAudio, "audio", "audio-playback-related issues"); // Don't forget to register your random source _rnd = new Common::RandomSource("WinterMute"); diff --git a/engines/wintermute/wintermute.h b/engines/wintermute/wintermute.h index e850a72196..5d5edb66de 100644 --- a/engines/wintermute/wintermute.h +++ b/engines/wintermute/wintermute.h @@ -38,7 +38,8 @@ enum { kWinterMuteDebugLog = 1 << 0, // The debug-logs from the original engine kWinterMuteDebugSaveGame = 1 << 1, kWinterMuteDebugFont = 1 << 2, // next new channel must be 1 << 2 (4) - kWinterMuteDebugFileAccess = 1 << 3 // the current limitation is 32 debug channels (1 << 31 is the last one) + kWinterMuteDebugFileAccess = 1 << 3, // the current limitation is 32 debug channels (1 << 31 is the last one) + kWinterMuteDebugAudio = 1 << 4 }; class WinterMuteEngine : public Engine { -- cgit v1.2.3