aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorFilippos Karapetis2009-05-22 22:19:15 +0000
committerFilippos Karapetis2009-05-22 22:19:15 +0000
commitef4947060ef637d6b7e84c6c1b2981e69db8af91 (patch)
tree154216ad7c78f65a079f71551e2e8342a822d0b6 /engines/sci/engine
parent32533af8cf3787d979303d70d169dccab5e269cc (diff)
downloadscummvm-rg350-ef4947060ef637d6b7e84c6c1b2981e69db8af91.tar.gz
scummvm-rg350-ef4947060ef637d6b7e84c6c1b2981e69db8af91.tar.bz2
scummvm-rg350-ef4947060ef637d6b7e84c6c1b2981e69db8af91.zip
Some initial WIP code on kDoAudio (still not working)
svn-id: r40790
Diffstat (limited to 'engines/sci/engine')
-rw-r--r--engines/sci/engine/ksound.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index df7770c172..19ed6e8b37 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -29,6 +29,9 @@
#include "sci/engine/kernel.h"
#include "sci/engine/vm.h" // for Object
+#include "sound/audiostream.h"
+#include "sound/mixer.h"
+
namespace Sci {
#define _K_SCI0_SOUND_INIT_HANDLE 0
@@ -83,6 +86,9 @@ namespace Sci {
#define _K_SCI1_SOUND_REVERB 19 /* Get/Set */
#define _K_SCI1_SOUND_UPDATE_VOL_PRI 20
+Audio::SoundHandle _audioHandle;
+uint16 _audioRate;
+
enum AudioCommands {
// TODO: find the difference between kSci1AudioWPlay and kSci1AudioPlay
kSci1AudioWPlay = 1, /* Plays an audio stream */
@@ -991,26 +997,49 @@ reg_t kDoSound(EngineState *s, int funct_nr, int argc, reg_t *argv) {
return kDoSound_SCI0(s, funct_nr, argc, argv);
}
+// 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();
+
switch (UKPV(0)) {
case kSci1AudioWPlay:
+ mixer->stopHandle(_audioHandle);
+ // TODO
+ warning("kDoAudio stub: AudioWPlay audio number %d", UKPV(1));
+ //mixer->playInputStream(Audio::Mixer::kSpeechSoundType, 0, newStream);
break;
case kSci1AudioPlay:
+ // TODO
+ warning("kDoAudio stub: AudioPlay audio number %d", UKPV(1));
break;
case kSci1AudioStop:
+ mixer->stopHandle(_audioHandle);
break;
case kSci1AudioPause:
+ mixer->pauseHandle(_audioHandle, true);
break;
case kSci1AudioResume:
+ mixer->pauseHandle(_audioHandle, false);
break;
- case kSci1AudioPosition :
- return make_reg(0, -1); /* Finish immediately */
+ case kSci1AudioPosition:
+ if (mixer->isSoundHandleActive(_audioHandle)) {
+ return make_reg(0, mixer->getSoundElapsedTime(_audioHandle) * 6 / 100); // return elapsed time in 1/60th
+ } else {
+ return make_reg(0, -1); // Sound finished
+ }
case kSci1AudioRate:
+ _audioRate = UKPV(1);
break;
case kSci1AudioVolume:
+ mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, UKPV(1));
break;
case kSci1AudioLanguage:
+ // TODO
+ warning("kDoAudio stub: Set audio language to %d", UKPV(1));
+ // TODO: CD Audio (is it even used?)
break;
+ default:
+ warning("kDoAudio: Unhandled case %d", UKPV(0));
}
return s->r_acc;