aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound.cpp
diff options
context:
space:
mode:
authorFlorian Kagerer2009-02-01 19:27:01 +0000
committerFlorian Kagerer2009-02-01 19:27:01 +0000
commit784c99b3dac507c5ee0686cc314c96caa7349ef3 (patch)
tree1dbcd6a62bc25505623ed693161b935389ea5498 /engines/kyra/sound.cpp
parentf90e4545c27fa92cc6ba835f80551556929df43d (diff)
downloadscummvm-rg350-784c99b3dac507c5ee0686cc314c96caa7349ef3.tar.gz
scummvm-rg350-784c99b3dac507c5ee0686cc314c96caa7349ef3.tar.bz2
scummvm-rg350-784c99b3dac507c5ee0686cc314c96caa7349ef3.zip
svn-id: r36178
Diffstat (limited to 'engines/kyra/sound.cpp')
-rw-r--r--engines/kyra/sound.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 5063fb5fed..487e0cfc07 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -115,6 +115,29 @@ int32 Sound::voicePlay(const char *file, bool isSfx) {
return audioStream->getTotalPlayTime();
}
+void Sound::voicePlayFromList(Common::List<const char*> fileList) {
+ int h = 0;
+ while (_mixer->isSoundHandleActive(_soundChannels[h].channelHandle) && h < kNumChannelHandles)
+ h++;
+ if (h >= kNumChannelHandles)
+ return;
+
+ Audio::AppendableAudioStream *out = Audio::makeAppendableAudioStream(22050, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED);
+
+ for (Common::List<const char*>::iterator i = fileList.begin(); i != fileList.end(); i++) {
+ int size;
+ int rate;
+ uint8 *file = _vm->resource()->fileData(*i, (uint32*)&size);
+ Common::MemoryReadStream vocStream(file, (uint32)size);
+ uint8 *data = Audio::loadVOCFromStream(vocStream, size, rate);
+ out->queueBuffer(data, size);
+ }
+ out->finish();
+
+ _soundChannels[h].file = *fileList.begin();
+ _mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, out);
+}
+
void Sound::voiceStop(const char *file) {
if (!file) {
for (int h = 0; h < kNumChannelHandles; h++) {