mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
MOHAWK: Always apply the volume when changing the background sound
This commit is contained in:
parent
1f6bfda0ef
commit
3a4a94bbd2
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user