aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/pregob/pregob.cpp
diff options
context:
space:
mode:
authorSven Hesse2012-07-01 03:45:09 +0200
committerSven Hesse2012-07-30 01:44:44 +0200
commit34cf81a4b614dee5f2657bf24d9f867165e6ced9 (patch)
tree9267b9f4da5f47d9758cbd57926ceb4bb1cd2cde /engines/gob/pregob/pregob.cpp
parent233a3f54fc3913669fd4c56a6c3a16da5aa5f5b6 (diff)
downloadscummvm-rg350-34cf81a4b614dee5f2657bf24d9f867165e6ced9.tar.gz
scummvm-rg350-34cf81a4b614dee5f2657bf24d9f867165e6ced9.tar.bz2
scummvm-rg350-34cf81a4b614dee5f2657bf24d9f867165e6ced9.zip
GOB: Add some PreGob sound utility functions
Diffstat (limited to 'engines/gob/pregob/pregob.cpp')
-rw-r--r--engines/gob/pregob/pregob.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/engines/gob/pregob/pregob.cpp b/engines/gob/pregob/pregob.cpp
index 582ebc6677..9c6cfb717a 100644
--- a/engines/gob/pregob/pregob.cpp
+++ b/engines/gob/pregob/pregob.cpp
@@ -32,6 +32,8 @@
#include "gob/video.h"
#include "gob/aniobject.h"
+#include "gob/sound/sound.h"
+
#include "gob/pregob/pregob.h"
static char kLanguageSuffix[5] = { 't', 'g', 'a', 'e', 'i' };
@@ -141,6 +143,39 @@ bool PreGob::isCursorVisible() const {
return CursorMan.isVisible();
}
+void PreGob::loadSounds(const char * const *sounds, uint soundCount) {
+ freeSounds();
+
+ _sounds.resize(soundCount);
+
+ for (uint i = 0; i < soundCount; i++) {
+ int32 size;
+ byte *data = _vm->_dataIO->getFile(sounds[i], size);
+
+ if (!data || !_sounds[i].load(SOUND_SND, data, size)) {
+ delete data;
+
+ warning("PreGob::loadSounds(): Failed to load sound \"%s\"", sounds[i]);
+ continue;
+ }
+ }
+}
+
+void PreGob::freeSounds() {
+ _sounds.clear();
+}
+
+void PreGob::playSound(uint sound, int16 frequency, int16 repCount) {
+ if (sound >= _sounds.size())
+ return;
+
+ _vm->_sound->blasterPlay(&_sounds[sound], repCount, frequency);
+}
+
+void PreGob::stopSound() {
+ _vm->_sound->blasterStop(0);
+}
+
void PreGob::endFrame(bool doInput) {
_vm->_draw->blitInvalidated();
_vm->_util->waitEndFrame();