aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision
diff options
context:
space:
mode:
Diffstat (limited to 'engines/zvision')
-rw-r--r--engines/zvision/console.cpp24
-rw-r--r--engines/zvision/console.h1
-rw-r--r--engines/zvision/zvision.cpp4
-rw-r--r--engines/zvision/zvision.h2
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();