aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound/audio.cpp
diff options
context:
space:
mode:
authorMatthew Hoops2010-06-10 20:26:59 +0000
committerMatthew Hoops2010-06-10 20:26:59 +0000
commit9f907aac095123ac016a23a559f54ada35af6772 (patch)
tree932c0f972e1a0c31bd943ebbf61888a1e1ac82cf /engines/sci/sound/audio.cpp
parent8f55c4ddb4ceb64e6121ee9fe08b07c2905d4748 (diff)
downloadscummvm-rg350-9f907aac095123ac016a23a559f54ada35af6772.tar.gz
scummvm-rg350-9f907aac095123ac016a23a559f54ada35af6772.tar.bz2
scummvm-rg350-9f907aac095123ac016a23a559f54ada35af6772.zip
kSciAudioWPlay should not actually play the song, but 'pre-load' it. We fake the pre-loading with a flag that will return 0 if the song has been called with kSciAudioWPlay. Fixes the dream sequence sound in MUMG.
svn-id: r49583
Diffstat (limited to 'engines/sci/sound/audio.cpp')
-rw-r--r--engines/sci/sound/audio.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/engines/sci/sound/audio.cpp b/engines/sci/sound/audio.cpp
index f10cc5ed68..62cfcd9621 100644
--- a/engines/sci/sound/audio.cpp
+++ b/engines/sci/sound/audio.cpp
@@ -47,6 +47,7 @@ AudioPlayer::AudioPlayer(ResourceManager *resMan) : _resMan(resMan), _audioRate(
_syncResource(NULL), _syncOffset(0), _audioCdStart(0) {
_mixer = g_system->getMixer();
+ _wPlayFlag = false;
}
AudioPlayer::~AudioPlayer() {
@@ -65,6 +66,7 @@ int AudioPlayer::startAudio(uint16 module, uint32 number) {
Audio::AudioStream *audioStream = getAudioStream(number, module, &sampleLen);
if (audioStream) {
+ _wPlayFlag = false;
_mixer->playStream(Audio::Mixer::kSpeechSoundType, &_audioHandle, audioStream);
return sampleLen;
}
@@ -72,6 +74,18 @@ int AudioPlayer::startAudio(uint16 module, uint32 number) {
return 0;
}
+int AudioPlayer::wPlayAudio(uint16 module, uint32 tuple) {
+ // Get the audio sample length and set the wPlay flag so we return 0 on position.
+ // SSCI pre-loads the audio here, but it's much easier for us to just get the
+ // sample length and return that. wPlayAudio should *not* actually start the sample.
+
+ int sampleLen = 0;
+ Audio::AudioStream *audioStream = getAudioStream(module, tuple, &sampleLen);
+ delete audioStream;
+ _wPlayFlag = true;
+ return sampleLen;
+}
+
void AudioPlayer::stopAudio() {
_mixer->stopHandle(_audioHandle);
}
@@ -87,6 +101,8 @@ void AudioPlayer::resumeAudio() {
int AudioPlayer::getAudioPosition() {
if (_mixer->isSoundHandleActive(_audioHandle))
return _mixer->getSoundElapsedTime(_audioHandle) * 6 / 100; // return elapsed time in ticks
+ else if (_wPlayFlag)
+ return 0; // Sound has "loaded" so return that it hasn't started
else
return -1; // Sound finished
}