aboutsummaryrefslogtreecommitdiff
path: root/engines/mohawk/sound.cpp
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/sound.cpp
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/sound.cpp')
-rw-r--r--engines/mohawk/sound.cpp12
1 files changed, 6 insertions, 6 deletions
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() {