From 1fb422cde207b8b24ab9e8a545abb4c9204773c3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 2 Dec 2013 08:29:51 -0500 Subject: VOYEUR: Implemented sound effects for the lock screen --- engines/voyeur/sound.cpp | 15 +++++++++++---- engines/voyeur/sound.h | 6 +++++- engines/voyeur/voyeur.cpp | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/engines/voyeur/sound.cpp b/engines/voyeur/sound.cpp index 628e6e27a9..baba45fb45 100644 --- a/engines/voyeur/sound.cpp +++ b/engines/voyeur/sound.cpp @@ -20,15 +20,22 @@ * */ +#include "audio/audiostream.h" +#include "audio/decoders/raw.h" +#include "common/memstream.h" #include "voyeur/sound.h" namespace Voyeur { -SoundManager::SoundManager() { +SoundManager::SoundManager(Audio::Mixer *mixer) { + _mixer = mixer; } void SoundManager::playVOCMap(byte *voc, int vocSize) { - // TODO + Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(voc, vocSize, DisposeAfterUse::NO); + Audio::AudioStream *audioStream = Audio::makeVOCStream(dataStream, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES); + + _mixer->playStream(Audio::Mixer::kSFXSoundType, &_soundHandle, audioStream); } bool SoundManager::vocMapStatus() { @@ -37,11 +44,11 @@ bool SoundManager::vocMapStatus() { } void SoundManager::continueVocMap() { - // TODO + // No implementation needed in ScummVM } void SoundManager::abortVOCMap() { - // TODO + _mixer->stopHandle(_soundHandle); } } // End of namespace Voyeur diff --git a/engines/voyeur/sound.h b/engines/voyeur/sound.h index 01d5dc20b9..0784b9274e 100644 --- a/engines/voyeur/sound.h +++ b/engines/voyeur/sound.h @@ -25,6 +25,8 @@ #include "common/scummsys.h" #include "common/str.h" +#include "audio/mixer.h" +#include "audio/decoders/voc.h" #include "voyeur/files.h" namespace Voyeur { @@ -32,8 +34,10 @@ namespace Voyeur { class SoundManager { private: VoyeurEngine *_vm; + Audio::Mixer *_mixer; + Audio::SoundHandle _soundHandle; public: - SoundManager(); + SoundManager(Audio::Mixer *mixer); void setVm(VoyeurEngine *vm) { _vm = vm; } void playVOCMap(byte *voc, int vocSize); diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp index 871fc41d25..bafc360728 100644 --- a/engines/voyeur/voyeur.cpp +++ b/engines/voyeur/voyeur.cpp @@ -33,7 +33,7 @@ namespace Voyeur { VoyeurEngine *g_vm; VoyeurEngine::VoyeurEngine(OSystem *syst, const VoyeurGameDescription *gameDesc) : Engine(syst), - _gameDescription(gameDesc), _randomSource("Voyeur"), + _gameDescription(gameDesc), _randomSource("Voyeur"), _soundManager(_mixer), _defaultFontInfo(3, 0xff, 0xff, 0, 0, ALIGN_LEFT, 0, Common::Point(), 1, 1, Common::Point(1, 1), 1, 0, 0) { DebugMan.addDebugChannel(kDebugPath, "Path", "Pathfinding debug level"); -- cgit v1.2.3