aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/sound.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-08-10 22:01:02 -0400
committerPaul Gilbert2015-08-10 22:01:02 -0400
commit9b0bf9e21555fb1760d45792ab4bd6bcb67d08c6 (patch)
tree9fbe2561aad6363d60f6c85006f49d254285ef25 /engines/sherlock/sound.cpp
parent60759cfb5d5fcd605543fa4a03400ed34d778667 (diff)
downloadscummvm-rg350-9b0bf9e21555fb1760d45792ab4bd6bcb67d08c6.tar.gz
scummvm-rg350-9b0bf9e21555fb1760d45792ab4bd6bcb67d08c6.tar.bz2
scummvm-rg350-9b0bf9e21555fb1760d45792ab4bd6bcb67d08c6.zip
SHERLOCK: RT: Beginnings of speech code
Diffstat (limited to 'engines/sherlock/sound.cpp')
-rw-r--r--engines/sherlock/sound.cpp34
1 files changed, 25 insertions, 9 deletions
diff --git a/engines/sherlock/sound.cpp b/engines/sherlock/sound.cpp
index e63efeec24..ffc626c6f8 100644
--- a/engines/sherlock/sound.cpp
+++ b/engines/sherlock/sound.cpp
@@ -57,6 +57,7 @@ Sound::Sound(SherlockEngine *vm, Audio::Mixer *mixer) : _vm(vm), _mixer(mixer) {
_voices = 0;
_diskSoundPlaying = false;
_soundPlaying = false;
+ _speechPlaying = false;
_soundIsOn = &_soundPlaying;
_curPriority = 0;
_digiBuf = nullptr;
@@ -174,15 +175,6 @@ bool Sound::playSound(const Common::String &name, WaitType waitType, int priorit
free(data);
-#if 0
- // Debug : used to dump files
- Common::DumpFile outFile;
- outFile.open(filename);
- outFile.write(decoded, (size - 2) * 2);
- outFile.flush();
- outFile.close();
-#endif
-
audioStream = Audio::makeRawStream(decoded, (size - 2) * 2, rate, Audio::FLAG_UNSIGNED, DisposeAfterUse::YES);
} else {
audioStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
@@ -270,5 +262,29 @@ void Sound::setVolume(int volume) {
warning("TODO: setVolume - %d", volume);
}
+void Sound::playSpeech(const Common::String &name) {
+ Resources &res = *_vm->_res;
+ Scene &scene = *_vm->_scene;
+ stopSpeech();
+
+ Common::String libraryName = Common::String::format("speech%02d.lib", scene._currentScene);
+ res.addToCache(libraryName);
+
+ // TODO: Doesn't seem to be WAV files. Need to find out what format it is..
+ Common::SeekableReadStream *stream = res.load(name, libraryName);
+ Audio::AudioStream *audioStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES);
+ _mixer->playStream(Audio::Mixer::kSpeechSoundType, &_speechHandle, audioStream, -1, Audio::Mixer::kMaxChannelVolume);
+ _speechPlaying = true;
+}
+
+void Sound::stopSpeech() {
+ _mixer->stopHandle(_speechHandle);
+}
+
+bool Sound::isSpeechPlaying() {
+ _speechOn = _mixer->isSoundHandleActive(_speechHandle);
+ return _speechPlaying;
+}
+
} // End of namespace Sherlock