diff options
author | Paul Gilbert | 2016-08-27 16:33:32 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-08-27 16:33:32 -0400 |
commit | 0c199f079bc1ed62e6c13f292d569fc52eac546c (patch) | |
tree | f9942f178447e72afcf9b55449b80383744ec9ac | |
parent | 552f0cce8e5af656568b4cac2a2fd665f2e8809d (diff) | |
download | scummvm-rg350-0c199f079bc1ed62e6c13f292d569fc52eac546c.tar.gz scummvm-rg350-0c199f079bc1ed62e6c13f292d569fc52eac546c.tar.bz2 scummvm-rg350-0c199f079bc1ed62e6c13f292d569fc52eac546c.zip |
XEEN: Beginnings of sound effects support
-rw-r--r-- | engines/xeen/dialogs_info.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/dialogs_input.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/sound.cpp | 32 | ||||
-rw-r--r-- | engines/xeen/sound.h | 27 | ||||
-rw-r--r-- | engines/xeen/worldofxeen/darkside_cutscenes.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/xeen.cpp | 3 |
6 files changed, 57 insertions, 13 deletions
diff --git a/engines/xeen/dialogs_info.cpp b/engines/xeen/dialogs_info.cpp index 7ccaa7fe71..56755630da 100644 --- a/engines/xeen/dialogs_info.cpp +++ b/engines/xeen/dialogs_info.cpp @@ -81,7 +81,7 @@ void InfoDialog::execute() { void InfoDialog::protectionText() { Party &party = *_vm->_party; - Common::StringArray _lines; +// Common::StringArray _lines; const char *const AA_L024 = "\x3l\n\x9""024"; const char *const AA_R124 = "\x3r\x9""124"; diff --git a/engines/xeen/dialogs_input.cpp b/engines/xeen/dialogs_input.cpp index 8b754ab6de..eec6088a2c 100644 --- a/engines/xeen/dialogs_input.cpp +++ b/engines/xeen/dialogs_input.cpp @@ -263,6 +263,8 @@ int Choose123::execute(int numOptions) { _vm->_mode = oldMode; intf.mainIconsPrint(); + + return result; } void Choose123::loadButtons(int numOptions) { diff --git a/engines/xeen/sound.cpp b/engines/xeen/sound.cpp index 00b92472cc..ec8b8c6387 100644 --- a/engines/xeen/sound.cpp +++ b/engines/xeen/sound.cpp @@ -20,27 +20,51 @@ * */ +#include "audio/decoders/voc.h" #include "xeen/sound.h" +#include "xeen/xeen.h" namespace Xeen { +SoundManager *VOC::_sound; + +void VOC::init(XeenEngine *vm) { + _sound = vm->_sound; +} + +void VOC::play() { + _sound->playSound(this, _soundHandle); +} + void VOC::stop() { - warning("TODO: VOC::stop"); + _sound->stopSound(_soundHandle); } -SoundManager::SoundManager(XeenEngine *vm): _vm(vm) { +/*------------------------------------------------------------------------*/ + +SoundManager::SoundManager(XeenEngine *vm, Audio::Mixer *mixer): _vm(vm), _mixer(mixer) { } void SoundManager::proc2(Common::SeekableReadStream &f) { - + // TODO } void SoundManager::startMusic(int v1) { - + // TODO } void SoundManager::stopMusic(int id) { + // TODO } +void SoundManager::playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle) { + Audio::SeekableAudioStream *stream = Audio::makeVOCStream(s, 0); + _mixer->playStream(Audio::Mixer::kPlainSoundType, &soundHandle, stream); + +} + +void SoundManager::stopSound(Audio::SoundHandle &soundHandle) { + _mixer->stopHandle(soundHandle); +} } // End of namespace Xeen diff --git a/engines/xeen/sound.h b/engines/xeen/sound.h index 5c123d7d89..172ef9eece 100644 --- a/engines/xeen/sound.h +++ b/engines/xeen/sound.h @@ -23,6 +23,8 @@ #ifndef XEEN_SOUND_H #define XEEN_SOUND_H +#include "audio/mixer.h" +#include "audio/audiostream.h" #include "common/scummsys.h" #include "common/system.h" #include "xeen/files.h" @@ -32,12 +34,18 @@ namespace Xeen { class SoundManager; class VOC: public Common::File { - friend class SoundManager; private: - SoundManager *_sound; + static SoundManager *_sound; + Audio::SoundHandle _soundHandle; public: - VOC() : _sound(nullptr) {} + VOC() {} virtual ~VOC() { stop(); } + static void init(XeenEngine *vm); + + /** + * Start playing the sound + */ + void play(); /** * Stop playing the sound @@ -48,8 +56,9 @@ public: class SoundManager { private: XeenEngine *_vm; + Audio::Mixer *_mixer; public: - SoundManager(XeenEngine *vm); + SoundManager(XeenEngine *vm, Audio::Mixer *mixer); void proc2(Common::SeekableReadStream &f); @@ -61,7 +70,15 @@ public: void playSong(Common::SeekableReadStream &f) {} - void playSound(VOC &voc) {} + /** + * Play a given sound + */ + void playSound(Common::SeekableReadStream *s, Audio::SoundHandle &soundHandle); + + /** + * Stop playing a sound + */ + void stopSound(Audio::SoundHandle &soundHandle); void playSample(const Common::SeekableReadStream *stream, int v2 = 1) {} diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp index 90efef1a96..6226b52a11 100644 --- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp +++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp @@ -66,7 +66,7 @@ bool DarkSideCutscenes::showDarkSideTitle() { switch (idx) { case 17: - sound.playSound(voc[0]); + voc[0].play(); break; case 34: case 44: @@ -74,7 +74,7 @@ bool DarkSideCutscenes::showDarkSideTitle() { nwcFrame = 0; break; case 35: - sound.playSound(voc[1]); + voc[1].play(); break; default: ++nwcFrame; diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp index 90349858ee..3b317f52d6 100644 --- a/engines/xeen/xeen.cpp +++ b/engines/xeen/xeen.cpp @@ -95,9 +95,10 @@ void XeenEngine::initialize() { _screen = new Screen(this); _scripts = new Scripts(this); _screen->setupWindows(); - _sound = new SoundManager(this); + _sound = new SoundManager(this, _mixer); _spells = new Spells(this); _town = new Town(this); + VOC::init(this); File f("029.obj"); _eventData = f.readStream(f.size()); |