diff options
author | D G Turner | 2012-06-02 22:28:34 +0100 |
---|---|---|
committer | D G Turner | 2012-06-02 22:28:34 +0100 |
commit | db77b9e4a7f8491d45b47b539af2077fb15e9376 (patch) | |
tree | bf0be10517d840b8f0d985d5f6e3fe3eecc024a0 | |
parent | 030509c8eb4544885dabf67b85f83d3b296230de (diff) | |
download | scummvm-rg350-db77b9e4a7f8491d45b47b539af2077fb15e9376.tar.gz scummvm-rg350-db77b9e4a7f8491d45b47b539af2077fb15e9376.tar.bz2 scummvm-rg350-db77b9e4a7f8491d45b47b539af2077fb15e9376.zip |
DREAMWEB: Modify sound code to prevent missing sound effects.
This should fix bug #3528164 "DREAMWEB: missing sound
effects/music cues during main title" by preventing repeated calls
of SFX id 12 being lost if the next call is made before the sound
handler has cleared the previous one.
-rw-r--r-- | engines/dreamweb/sound.cpp | 10 | ||||
-rw-r--r-- | engines/dreamweb/sound.h | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp index 4b636d4789..76c734e932 100644 --- a/engines/dreamweb/sound.cpp +++ b/engines/dreamweb/sound.cpp @@ -41,6 +41,7 @@ DreamWebSound::DreamWebSound(DreamWebEngine *vm) : _vm(vm) { _currentSample = 0xff; _channel0Playing = 0; _channel0Repeat = 0; + _channel0NewSound = false; _channel1Playing = 255; _volume = 0; @@ -80,6 +81,12 @@ void DreamWebSound::volumeAdjust() { void DreamWebSound::playChannel0(uint8 index, uint8 repeat) { debug(1, "playChannel0(index:%d, repeat:%d)", index, repeat); + + if (index == _channel0Playing) { + warning("playChannel0(index: %d) already playing! Forcing restart...", index); + _channel0NewSound = true; + } + _channel0Playing = index; _channel0Repeat = repeat; } @@ -230,8 +237,9 @@ void DreamWebSound::soundHandler() { ch1 = 0; uint8 ch0loop = _channel0Repeat; - if (_channel0 != ch0) { + if (_channel0 != ch0 || _channel0NewSound) { _channel0 = ch0; + _channel0NewSound = false; if (ch0) { playSound(0, ch0, ch0loop); } diff --git a/engines/dreamweb/sound.h b/engines/dreamweb/sound.h index 62def157e7..a38dbf3c1a 100644 --- a/engines/dreamweb/sound.h +++ b/engines/dreamweb/sound.h @@ -73,6 +73,7 @@ private: uint8 _currentSample; uint8 _channel0Playing; uint8 _channel0Repeat; + bool _channel0NewSound; uint8 _channel1Playing; uint8 _volume; |