aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authorFilippos Karapetis2009-05-24 09:40:48 +0000
committerFilippos Karapetis2009-05-24 09:40:48 +0000
commit8ab0f0256e343c0e8ee28ab67f1244171d1e5d4f (patch)
treef0a9bf7a12ea691dc723a9615aa2c9fc14dd9bb8 /engines/sci
parent5a32f3f502de47486368dfcbbc271e167a596d44 (diff)
downloadscummvm-rg350-8ab0f0256e343c0e8ee28ab67f1244171d1e5d4f.tar.gz
scummvm-rg350-8ab0f0256e343c0e8ee28ab67f1244171d1e5d4f.tar.bz2
scummvm-rg350-8ab0f0256e343c0e8ee28ab67f1244171d1e5d4f.zip
Fixed audio synchronization in the CD version of KQ5
svn-id: r40855
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/ksound.cpp9
-rw-r--r--engines/sci/resource.cpp2
2 files changed, 8 insertions, 3 deletions
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index b8b5037ab9..7cd39d3c7e 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -1029,6 +1029,7 @@ bool findAudEntry(uint16 audioNumber, byte& volume, uint32& offset, uint32& size
// Used for speech playback in CD games
reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) {
Audio::Mixer *mixer = g_system->getMixer();
+ int sampleLen = 0;
switch (UKPV(0)) {
case kSci1AudioWPlay:
@@ -1041,6 +1042,7 @@ reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (audioRes) {
audioStream = Audio::makeLinearInputStream(audioRes->data, audioRes->size, _audioRate, Audio::Mixer::FLAG_UNSIGNED, 0, 0);
+ sampleLen = audioRes->size * 60 / _audioRate;
} else {
// No patch file found, read it from the audio volume
byte volume;
@@ -1070,13 +1072,16 @@ reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) {
Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED, 0, 0);
}
}
+
+ sampleLen = size * 60 / _audioRate;
}
}
if (audioStream)
mixer->playInputStream(Audio::Mixer::kSpeechSoundType, &_audioHandle, audioStream);
}
- break;
+
+ return make_reg(0, sampleLen); // return sample length in ticks
case kSci1AudioStop:
mixer->stopHandle(_audioHandle);
break;
@@ -1088,7 +1093,7 @@ reg_t kDoAudio(EngineState *s, int funct_nr, int argc, reg_t *argv) {
break;
case kSci1AudioPosition:
if (mixer->isSoundHandleActive(_audioHandle)) {
- return make_reg(0, mixer->getSoundElapsedTime(_audioHandle) * 6 / 100); // return elapsed time in 1/60th
+ return make_reg(0, mixer->getSoundElapsedTime(_audioHandle) * 6 / 100); // return elapsed time in ticks
} else {
return make_reg(0, -1); // Sound finished
}
diff --git a/engines/sci/resource.cpp b/engines/sci/resource.cpp
index 1d3d102688..576b2afc20 100644
--- a/engines/sci/resource.cpp
+++ b/engines/sci/resource.cpp
@@ -54,7 +54,7 @@ const char *sci_version_types[] = {
"SCI WIN/32"
};
-const int sci_max_resource_nr[] = {65536, 1000, 2048, 2048, 2048, 8192, 8192, 65536};
+const int sci_max_resource_nr[] = {65536, 1000, 2048, 2048, 2048, 65536, 65536, 65536};
const char *sci_error_types[] = {
"No error",