diff options
author | Colin Snover | 2017-03-12 16:03:06 -0500 |
---|---|---|
committer | Colin Snover | 2017-04-23 13:07:25 -0500 |
commit | 8bdfb7889572b680add712d461ebd868329e42b9 (patch) | |
tree | b9d44facc720bbc1a64e77b38666c3a16de5fb47 /engines/sci | |
parent | eb9965274d18d6bc23c976fe7e7b72747001fb8e (diff) | |
download | scummvm-rg350-8bdfb7889572b680add712d461ebd868329e42b9.tar.gz scummvm-rg350-8bdfb7889572b680add712d461ebd868329e42b9.tar.bz2 scummvm-rg350-8bdfb7889572b680add712d461ebd868329e42b9.zip |
SCI32: Add debugger command to list digital audio samples
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/console.cpp | 17 | ||||
-rw-r--r-- | engines/sci/console.h | 1 | ||||
-rw-r--r-- | engines/sci/sound/audio32.cpp | 31 | ||||
-rw-r--r-- | engines/sci/sound/audio32.h | 7 |
4 files changed, 56 insertions, 0 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index b8e6097c06..d67bd694ab 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -169,6 +169,7 @@ Console::Console(SciEngine *engine) : GUI::Debugger(), registerCmd("sfx01_track", WRAP_METHOD(Console, cmdSfx01Track)); registerCmd("show_instruments", WRAP_METHOD(Console, cmdShowInstruments)); registerCmd("map_instrument", WRAP_METHOD(Console, cmdMapInstrument)); + registerCmd("audio_list", WRAP_METHOD(Console, cmdAudioList)); // Script registerCmd("addresses", WRAP_METHOD(Console, cmdAddresses)); registerCmd("registers", WRAP_METHOD(Console, cmdRegisters)); @@ -418,6 +419,7 @@ bool Console::cmdHelp(int argc, const char **argv) { debugPrintf(" sfx01_track - Dumps a track of a SCI01 song\n"); debugPrintf(" show_instruments - Shows the instruments of a specific song, or all songs\n"); debugPrintf(" map_instrument - Dynamically maps an MT-32 instrument to a GM instrument\n"); + debugPrintf(" audio_list - Lists currently active digital audio samples (SCI2.1+)\n"); debugPrintf("\n"); debugPrintf("Script:\n"); debugPrintf(" addresses - Provides information on how to pass addresses\n"); @@ -1318,6 +1320,21 @@ bool Console::cmdMapInstrument(int argc, const char **argv) { return true; } +bool Console::cmdAudioList(int argc, const char **argv) { +#ifdef ENABLE_SCI32 + if (_engine->_audio32) { + debugPrintf("Audio list (%d active channels):\n", _engine->_audio32->getNumActiveChannels()); + _engine->_audio32->printAudioList(this); + } else { + debugPrintf("This SCI version does not have a software digital audio mixer\n"); + } +#else + debugPrintf("SCI32 isn't included in this compiled executable\n"); +#endif + + return true; +} + bool Console::cmdSaveGame(int argc, const char **argv) { if (argc != 2) { debugPrintf("Saves the current game state to the hard disk\n"); diff --git a/engines/sci/console.h b/engines/sci/console.h index 366f959273..1bb86b9bee 100644 --- a/engines/sci/console.h +++ b/engines/sci/console.h @@ -127,6 +127,7 @@ private: bool cmdSfx01Track(int argc, const char **argv); bool cmdShowInstruments(int argc, const char **argv); bool cmdMapInstrument(int argc, const char **argv); + bool cmdAudioList(int argc, const char **argv); // Script bool cmdAddresses(int argc, const char **argv); bool cmdRegisters(int argc, const char **argv); diff --git a/engines/sci/sound/audio32.cpp b/engines/sci/sound/audio32.cpp index df21a5fdcb..b61bbd9a4e 100644 --- a/engines/sci/sound/audio32.cpp +++ b/engines/sci/sound/audio32.cpp @@ -35,6 +35,7 @@ #include "common/textconsole.h" // for warning #include "common/types.h" // for Flag::NO #include "engine.h" // for Engine, g_engine +#include "sci/console.h" // for Console #include "sci/engine/features.h" // for GameFeatures #include "sci/engine/guest_additions.h" // for GuestAdditions #include "sci/engine/state.h" // for EngineState @@ -1185,4 +1186,34 @@ void Audio32::kernelLoop(const int argc, const reg_t *const argv) { setLoop(channelIndex, loop); } +#pragma mark - +#pragma mark Debugging + +void Audio32::printAudioList(Console *con) const { + Common::StackLock lock(_mutex); + for (int i = 0; i < _numActiveChannels; ++i) { + const AudioChannel &channel = _channels[i]; + con->debugPrintf(" %d[%04x:%04x]: %s, started at %d, pos %d/%d, vol %d, pan %d%s%s\n", + i, + PRINT_REG(channel.soundNode), + channel.robot ? "robot" : channel.resource->name().c_str(), + channel.startedAtTick, + (g_sci->getTickCount() - channel.startedAtTick) % channel.duration, + channel.duration, + channel.volume, + channel.pan, + channel.loop ? ", looping" : "", + channel.pausedAtTick ? ", paused" : ""); + if (channel.fadeStartTick) { + con->debugPrintf(" fade: vol %d -> %d, started at %d, pos %d/%d%s\n", + channel.fadeStartVolume, + channel.fadeTargetVolume, + channel.fadeStartTick, + (g_sci->getTickCount() - channel.fadeStartTick) % channel.duration, + channel.fadeDuration, + channel.stopChannelOnFade ? ", stopping" : ""); + } + } +} + } // End of namespace Sci diff --git a/engines/sci/sound/audio32.h b/engines/sci/sound/audio32.h index c953582965..f77f676b64 100644 --- a/engines/sci/sound/audio32.h +++ b/engines/sci/sound/audio32.h @@ -33,6 +33,8 @@ #include "sci/video/robot_decoder.h" // for RobotAudioStream namespace Sci { +class Console; + #pragma mark AudioChannel /** @@ -610,6 +612,11 @@ public: reg_t kernelMixing(const int argc, const reg_t *const argv); reg_t kernelFade(const int argc, const reg_t *const argv); void kernelLoop(const int argc, const reg_t *const argv); + +#pragma mark - +#pragma mark Debugging +public: + void printAudioList(Console *con) const; }; } // End of namespace Sci |