aboutsummaryrefslogtreecommitdiff
path: root/engines/made/scriptfuncs.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2009-01-06 12:33:59 +0000
committerFilippos Karapetis2009-01-06 12:33:59 +0000
commitde7721c63863018dc70aa5b7cf135d373c45892a (patch)
treede020ddc91751d24a27febc99abb7f54a4c764c3 /engines/made/scriptfuncs.cpp
parente2463f77cdc4a11038843668988b388d03f06477 (diff)
downloadscummvm-rg350-de7721c63863018dc70aa5b7cf135d373c45892a.tar.gz
scummvm-rg350-de7721c63863018dc70aa5b7cf135d373c45892a.tar.bz2
scummvm-rg350-de7721c63863018dc70aa5b7cf135d373c45892a.zip
Sound energy values are now stored in a list, to account for the fact that the original decompressed sounds on the fly, but we're decompressing them when the sound is being loaded
svn-id: r35752
Diffstat (limited to 'engines/made/scriptfuncs.cpp')
-rw-r--r--engines/made/scriptfuncs.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/engines/made/scriptfuncs.cpp b/engines/made/scriptfuncs.cpp
index e102a15487..ce084bfc7d 100644
--- a/engines/made/scriptfuncs.cpp
+++ b/engines/made/scriptfuncs.cpp
@@ -237,6 +237,7 @@ int16 ScriptFunctions::sfPlaySound(int16 argc, int16 *argv) {
_vm->_autoStopSound = (argv[0] == 1);
}
if (soundNum > 0) {
+ soundEnergy.clear();
_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
_vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, false));
}
@@ -546,6 +547,7 @@ int16 ScriptFunctions::sfPlayVoice(int16 argc, int16 *argv) {
int16 soundNum = argv[0];
_vm->_mixer->stopHandle(_audioStreamHandle);
if (soundNum > 0) {
+ soundEnergy.clear();
_vm->_mixer->playInputStream(Audio::Mixer::kPlainSoundType, &_audioStreamHandle,
_vm->_res->getSound(soundNum)->getAudioStream(_vm->_soundRate, false));
_vm->_autoStopSound = true;
@@ -599,7 +601,12 @@ int16 ScriptFunctions::sfClearMono(int16 argc, int16 *argv) {
int16 ScriptFunctions::sfGetSoundEnergy(int16 argc, int16 *argv) {
// This is called while in-game voices are played to animate
// mouths when NPCs are talking
- return soundEnergy;
+ int result = 0;
+ if (soundEnergy.size() > 0) {
+ result = *soundEnergy.begin();
+ soundEnergy.pop_front();
+ }
+ return result;
}
int16 ScriptFunctions::sfClearText(int16 argc, int16 *argv) {