aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/kyra/sound.cpp')
-rw-r--r--engines/kyra/sound.cpp18
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) {