diff options
author | richiesams | 2013-07-13 11:34:28 -0500 |
---|---|---|
committer | richiesams | 2013-08-04 13:32:16 -0500 |
commit | 8d2bef2936f555cbc675248838079dfe06ff562a (patch) | |
tree | 5f2d89cad72b446de4ad33dae87e27255f330c0a /engines/zvision | |
parent | 09358141de42a2ecb4ad487145dc52345814f8a1 (diff) | |
download | scummvm-rg350-8d2bef2936f555cbc675248838079dfe06ff562a.tar.gz scummvm-rg350-8d2bef2936f555cbc675248838079dfe06ff562a.tar.bz2 scummvm-rg350-8d2bef2936f555cbc675248838079dfe06ff562a.zip |
ZVISION: Create console command for loading sounds
Diffstat (limited to 'engines/zvision')
-rw-r--r-- | engines/zvision/console.cpp | 24 | ||||
-rw-r--r-- | engines/zvision/console.h | 1 | ||||
-rw-r--r-- | engines/zvision/zvision.cpp | 4 | ||||
-rw-r--r-- | engines/zvision/zvision.h | 2 |
4 files changed, 31 insertions, 0 deletions
diff --git a/engines/zvision/console.cpp b/engines/zvision/console.cpp index f038af1232..c3be4ba0f5 100644 --- a/engines/zvision/console.cpp +++ b/engines/zvision/console.cpp @@ -23,16 +23,21 @@ #include "common/scummsys.h" #include "gui/debugger.h" +#include "common/file.h" +#include "common/bufferedstream.h" +#include "audio/mixer.h" #include "zvision/console.h" #include "zvision/zvision.h" #include "zvision/zork_avi_decoder.h" +#include "zvision/zork_raw.h" namespace ZVision { Console::Console(ZVision *engine) : GUI::Debugger(), _engine(engine) { DCmd_Register("loadimage", WRAP_METHOD(Console, cmdLoadImage)); DCmd_Register("loadvideo", WRAP_METHOD(Console, cmdLoadVideo)); + DCmd_Register("loadsound", WRAP_METHOD(Console, cmdLoadSound)); } bool Console::cmdLoadImage(int argc, const char **argv) { @@ -59,4 +64,23 @@ bool Console::cmdLoadVideo(int argc, const char **argv) { return true; } +bool Console::cmdLoadSound(int argc, const char **argv) { + if (argc != 3) { + DebugPrintf("Use loadsound <fileName> <rate> to load a video to the screen"); + return true; + } + + Common::File *file = new Common::File(); + if (!file->open(argv[1])) { + DebugPrintf("File does not exist"); + return true; + } + + Audio::AudioStream *soundStream = makeRawZorkStream(wrapBufferedSeekableReadStream(file, 2048, DisposeAfterUse::YES), atoi(argv[2]), DisposeAfterUse::YES); + Audio::SoundHandle handle; + _engine->getMixer()->playStream(Audio::Mixer::kPlainSoundType, &handle, soundStream, -1, 100, 0, DisposeAfterUse::YES, false, false); + + return true; +} + } // End of namespace ZVision diff --git a/engines/zvision/console.h b/engines/zvision/console.h index 66037983ae..354051d2b0 100644 --- a/engines/zvision/console.h +++ b/engines/zvision/console.h @@ -39,6 +39,7 @@ namespace ZVision { bool cmdLoadImage(int argc, const char **argv); bool cmdLoadVideo(int argc, const char **argv); + bool cmdLoadSound(int argc, const char **argv); }; } // End of namespace ZVision diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index 475a453c08..ba08122ba5 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -154,4 +154,8 @@ Common::RandomSource *ZVision::getRandomSource() const { return _rnd; } +Audio::Mixer *ZVision::getMixer() const { + return _mixer; +} + } // End of namespace ZVision diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 50394a6070..11773a33ad 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -76,6 +76,8 @@ public: virtual Common::Error run(); ScriptManager *getScriptManager() const; Common::RandomSource *getRandomSource() const; + Audio::Mixer *getMixer() const; + void renderImageToScreen(const Common::String &fileName, uint32 x, uint32 y); void startVideo(Video::VideoDecoder *videoDecoder); void continueVideo(); |