aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2014-02-13 00:35:21 +0100
committerTorbjörn Andersson2014-02-13 00:38:04 +0100
commit2b40502503bc5e6a99b53cd45d4eeeccc43dc718 (patch)
treeb89ac37ca4dd73a8481424bf4dac577aa42cbe9e
parent12e9c31f415a89b99dc389432afd3f32575be23b (diff)
downloadscummvm-rg350-2b40502503bc5e6a99b53cd45d4eeeccc43dc718.tar.gz
scummvm-rg350-2b40502503bc5e6a99b53cd45d4eeeccc43dc718.tar.bz2
scummvm-rg350-2b40502503bc5e6a99b53cd45d4eeeccc43dc718.zip
HOPKINS: Fix bug that could cause the music to stop prematurely
The SoundManager filled the sound handles with zeroes, which made the mixer confuse them with active sound handle zero. In my case, this happened to be the intro music, and the music was stopped when playWavSample() wrongly thought its sound handle was in use.
-rw-r--r--NEWS1
-rw-r--r--engines/hopkins/sound.cpp8
-rw-r--r--engines/hopkins/sound.h8
3 files changed, 9 insertions, 8 deletions
diff --git a/NEWS b/NEWS
index 8821dfe20a..239965450b 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ For a more comprehensive changelog of the latest experimental code, see:
Hopkins:
- Added an option to toggle Gore Mode from the ScummVM GUI.
+ - Fixed bug that could cause the music to stop prematurely.
SCI:
- Added support for the more detailed RAVE lip syncing data in the Windows
diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp
index 92c5f51462..704ebe3349 100644
--- a/engines/hopkins/sound.cpp
+++ b/engines/hopkins/sound.cpp
@@ -200,14 +200,6 @@ SoundManager::SoundManager(HopkinsEngine *vm) {
_currentSoundIndex = 0;
_oldSoundNumber = 0;
_modPlayingFl = false;
-
- for (int i = 0; i < VOICE_COUNT; ++i)
- Common::fill((byte *)&_voice[i], (byte *)&_voice[i] + sizeof(VoiceItem), 0);
- for (int i = 0; i < SWAV_COUNT; ++i)
- Common::fill((byte *)&_sWav[i], (byte *)&_sWav[i] + sizeof(SwavItem), 0);
- for (int i = 0; i < SOUND_COUNT; ++i)
- Common::fill((byte *)&_sound[i], (byte *)&_sound[i] + sizeof(SoundItem), 0);
- Common::fill((byte *)&_music, (byte *)&_music + sizeof(MusicItem), 0);
}
SoundManager::~SoundManager() {
diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h
index f1d047ae8b..6ebb6fdb02 100644
--- a/engines/hopkins/sound.h
+++ b/engines/hopkins/sound.h
@@ -33,12 +33,16 @@ namespace Hopkins {
class VoiceItem {
public:
+ VoiceItem() : _status(false), _wavIndex(0) {}
+
bool _status;
int _wavIndex;
};
class SwavItem {
public:
+ SwavItem() : _active(false), _audioStream(NULL), _freeSampleFl(false) {}
+
bool _active;
Audio::RewindableAudioStream *_audioStream;
Audio::SoundHandle _soundHandle;
@@ -47,11 +51,15 @@ public:
class MusicItem {
public:
+ MusicItem() : _active(false) {}
+
bool _active;
};
class SoundItem {
public:
+ SoundItem() : _active(false) {}
+
bool _active;
};