diff options
-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; |