aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk
diff options
context:
space:
mode:
authorBastien Bouclet2016-02-11 08:30:26 +0100
committerBastien Bouclet2016-02-11 08:30:26 +0100
commit3a4a94bbd2ae5f103e0081cdf03bba1559fc7663 (patch)
tree8a4c897d79504084cee5feb7e017894420df4d06 /engines/mohawk
parent1f6bfda0ef5556118892e45bc922ba3fdb64047a (diff)
downloadscummvm-rg350-3a4a94bbd2ae5f103e0081cdf03bba1559fc7663.tar.gz
scummvm-rg350-3a4a94bbd2ae5f103e0081cdf03bba1559fc7663.tar.bz2
scummvm-rg350-3a4a94bbd2ae5f103e0081cdf03bba1559fc7663.zip
MOHAWK: Always apply the volume when changing the background sound
Diffstat (limited to 'engines/mohawk')
-rw-r--r--engines/mohawk/myst_scripts.cpp5
-rw-r--r--engines/mohawk/sound.cpp12
-rw-r--r--engines/mohawk/sound.h2
3 files changed, 7 insertions, 12 deletions
diff --git a/engines/mohawk/myst_scripts.cpp b/engines/mohawk/myst_scripts.cpp
index 027a7fbf6c..a935ef5e5f 100644
--- a/engines/mohawk/myst_scripts.cpp
+++ b/engines/mohawk/myst_scripts.cpp
@@ -674,11 +674,6 @@ void MystScriptParser::o_copyImageToBackBuffer(uint16 op, uint16 var, uint16 arg
_vm->_gfx->copyImageSectionToBackBuffer(imageId, srcRect, dstRect);
}
-// TODO: Though the playSound and PlaySoundBlocking opcodes play sounds immediately,
-// this opcode changes the main background sound playing..
-// Current behavior here and with VIEW sound block is not right as demonstrated
-// by Channelwood Card 3280 (Tank Valve) and water flow sound behavior in pipe
-// on cards leading from shed...
void MystScriptParser::o_changeBackgroundSound(uint16 op, uint16 var, uint16 argc, uint16 *argv) {
// Used on Stoneship Card 2080
// Used on Channelwood Card 3225 with argc = 8 i.e. Conditional Sound List
diff --git a/engines/mohawk/sound.cpp b/engines/mohawk/sound.cpp
index 198627e012..74796c3eda 100644
--- a/engines/mohawk/sound.cpp
+++ b/engines/mohawk/sound.cpp
@@ -625,7 +625,7 @@ uint16 Sound::convertMystID(uint16 id) {
return id;
}
-Audio::SoundHandle *Sound::replaceBackgroundMyst(uint16 id, uint16 volume) {
+void Sound::replaceBackgroundMyst(uint16 id, uint16 volume) {
debug(0, "Replacing background sound with %d", id);
// TODO: The original engine does fading
@@ -641,8 +641,11 @@ Audio::SoundHandle *Sound::replaceBackgroundMyst(uint16 id, uint16 volume) {
// Check if sound is already playing
if (_mystBackgroundSound.type == kUsedHandle && _vm->_mixer->isSoundHandleActive(_mystBackgroundSound.handle)
- && _vm->getResourceName(ID_MSND, convertMystID(_mystBackgroundSound.id)).hasPrefix(prefix))
- return &_mystBackgroundSound.handle;
+ && _vm->getResourceName(ID_MSND, convertMystID(_mystBackgroundSound.id)).hasPrefix(prefix)) {
+ // The sound is already playing, just change the volume
+ changeBackgroundVolumeMyst(volume);
+ return;
+ }
// Stop old background sound
stopBackgroundMyst();
@@ -659,10 +662,7 @@ Audio::SoundHandle *Sound::replaceBackgroundMyst(uint16 id, uint16 volume) {
Audio::AudioStream *audStream = Audio::makeLoopingAudioStream(rewindStream, 0);
_vm->_mixer->playStream(Audio::Mixer::kPlainSoundType, &_mystBackgroundSound.handle, audStream, -1, volume >> 8);
- return &_mystBackgroundSound.handle;
}
-
- return NULL;
}
void Sound::stopBackgroundMyst() {
diff --git a/engines/mohawk/sound.h b/engines/mohawk/sound.h
index 75c9492d96..c62e6e9874 100644
--- a/engines/mohawk/sound.h
+++ b/engines/mohawk/sound.h
@@ -136,7 +136,7 @@ public:
// Myst-specific sound functions
Audio::SoundHandle *replaceSoundMyst(uint16 id, byte volume = Audio::Mixer::kMaxChannelVolume, bool loop = false);
- Audio::SoundHandle *replaceBackgroundMyst(uint16 id, uint16 volume = 0xFFFF);
+ void replaceBackgroundMyst(uint16 id, uint16 volume = 0xFFFF);
void pauseBackgroundMyst();
void resumeBackgroundMyst();
void stopBackgroundMyst();