diff options
author | Johannes Schickel | 2008-05-24 22:47:08 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-05-24 22:47:08 +0000 |
commit | 335eb1bf0853dbdede70fc4366fd1ff166715198 (patch) | |
tree | 40077f06fc91cef4b7937a1af17edfca1f981a87 /engines/kyra/sound.cpp | |
parent | 6866a4e133f2ae505bc142bc4b35e79d48f5191a (diff) | |
download | scummvm-rg350-335eb1bf0853dbdede70fc4366fd1ff166715198.tar.gz scummvm-rg350-335eb1bf0853dbdede70fc4366fd1ff166715198.tar.bz2 scummvm-rg350-335eb1bf0853dbdede70fc4366fd1ff166715198.zip |
Committed my fix for bug #1497437 "KYRA1: Subtitles glitch during 'Speech of the Land'".
svn-id: r32260
Diffstat (limited to 'engines/kyra/sound.cpp')
-rw-r--r-- | engines/kyra/sound.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp index 854e2de41f..137956196f 100644 --- a/engines/kyra/sound.cpp +++ b/engines/kyra/sound.cpp @@ -66,14 +66,14 @@ bool Sound::voiceFileIsPresent(const char *file) { return false; } -bool Sound::voicePlay(const char *file, bool isSfx) { +int32 Sound::voicePlay(const char *file, bool isSfx) { char filenamebuffer[25]; int h = 0; while (_mixer->isSoundHandleActive(_soundChannels[h].channelHandle) && h < kNumChannelHandles) h++; if (h >= kNumChannelHandles) - return false; + return 0; Audio::AudioStream *audioStream = 0; @@ -107,7 +107,7 @@ bool Sound::voicePlay(const char *file, bool isSfx) { _soundChannels[h].file = file; _mixer->playInputStream(isSfx ? Audio::Mixer::kSFXSoundType : Audio::Mixer::kSpeechSoundType, &_soundChannels[h].channelHandle, audioStream); - return true; + return audioStream->getTotalPlayTime(); } void Sound::voiceStop(const char *file) { @@ -140,6 +140,18 @@ bool Sound::voiceIsPlaying(const char *file) { return res; } +uint32 Sound::voicePlayedTime(const char *file) { + if (!file) + return 0; + + for (int i = 0; i < kNumChannelHandles; ++i) { + if (_soundChannels[i].file == file) + return _mixer->getSoundElapsedTime(_soundChannels[i].channelHandle); + } + + return 0; +} + #pragma mark - SoundMidiPC::SoundMidiPC(KyraEngine_v1 *vm, Audio::Mixer *mixer, MidiDriver *driver) : Sound(vm, mixer) { |