From 62c1c2633dbb94a84cffec093e6a2118946ef8c9 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Mon, 28 Dec 2009 11:23:20 +0000 Subject: SCI/new music code: Implemented the "songlib" debug command svn-id: r46670 --- engines/sci/console.cpp | 4 ++++ engines/sci/sfx/music.cpp | 12 ++++++++++++ engines/sci/sfx/music.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index e705a828f6..cdb4a1f476 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -43,6 +43,8 @@ #ifdef USE_OLD_MUSIC_FUNCTIONS #include "sci/sfx/iterator/songlib.h" // for SongLibrary #include "sci/sfx/iterator/iterator.h" // for SCI_SONG_ITERATOR_TYPE_SCI0 +#else +#include "sci/sfx/music.h" #endif #include "sci/sfx/softseq/mididriver.h" #include "sci/vocabulary.h" @@ -1623,6 +1625,8 @@ bool Console::cmdSongLib(int argc, const char **argv) { DebugPrintf("\n"); } while (seeker); DebugPrintf("\n"); +#else + _vm->getEngineState()->_soundCmd->_music->printSongLib(this); #endif return true; diff --git a/engines/sci/sfx/music.cpp b/engines/sci/sfx/music.cpp index 8094cbc5d8..fe22cf356a 100644 --- a/engines/sci/sfx/music.cpp +++ b/engines/sci/sfx/music.cpp @@ -27,6 +27,7 @@ #include "common/config-manager.h" #include "sci/sci.h" +#include "sci/console.h" #include "sci/resource.h" #include "sci/engine/kernel.h" #include "sci/engine/state.h" @@ -492,6 +493,17 @@ void SciMusic::soundSetMasterVolume(uint16 vol) { _pMixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, vol); } +void SciMusic::printSongLib(Console *con) { + Common::StackLock lock(_mutex); + const char *musicStatus[] = { "Stopped", "Initialized", "Paused", "Playing" }; + + for (uint32 i = 0; i < _playList.size(); i++) { + con->DebugPrintf("%d: %04x:%04x, priority: %d, status: %s\n", i, + PRINT_REG(_playList[i]->soundObj), _playList[i]->prio, + musicStatus[_playList[i]->status]); + } +} + void SciMusic::reconstructSounds(int savegame_version) { Common::StackLock lock(_mutex); diff --git a/engines/sci/sfx/music.h b/engines/sci/sfx/music.h index fb96063ff0..16400efcd0 100644 --- a/engines/sci/sfx/music.h +++ b/engines/sci/sfx/music.h @@ -140,6 +140,8 @@ public: _playList.push_back(slotEntry); } + void printSongLib(Console *con); + void reconstructSounds(int savegame_version); #ifndef USE_OLD_MUSIC_FUNCTIONS -- cgit v1.2.3