aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2010-09-16 04:43:49 +0000
committerTorbjörn Andersson2010-09-16 04:43:49 +0000
commitdf91686a36e8571e381a6aa0b4910595899f9bba (patch)
treeee224a2bbc11f8d15370d9c16a53f6577917e957
parent057056b8d335ab3fee8644e066e9db0a06451a90 (diff)
downloadscummvm-rg350-df91686a36e8571e381a6aa0b4910595899f9bba.tar.gz
scummvm-rg350-df91686a36e8571e381a6aa0b4910595899f9bba.tar.bz2
scummvm-rg350-df91686a36e8571e381a6aa0b4910595899f9bba.zip
AGI: Initialise PCjr emulator channels on creation
Because chanGen() gets called very early, and sometimes it crashes ScummVM as soon as the game starts. Actually, it's probably enough to initialise a couple of fields in _tchannel[], but I figured it couldn't hurt to clear all of _channel[] and _tchannel[]. svn-id: r52741
-rw-r--r--engines/agi/sound_pcjr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/engines/agi/sound_pcjr.cpp b/engines/agi/sound_pcjr.cpp
index b9d701d7f7..35c960d260 100644
--- a/engines/agi/sound_pcjr.cpp
+++ b/engines/agi/sound_pcjr.cpp
@@ -125,6 +125,9 @@ SoundGenPCJr::SoundGenPCJr(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(vm, p
_dissolveMethod = 3;
+ memset(_channel, 0, sizeof(_channel));
+ memset(_tchannel, 0, sizeof(_tchannel));
+
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);
}
@@ -158,7 +161,7 @@ void SoundGenPCJr::play(int resnum) {
void SoundGenPCJr::stop(void) {
int i;
- for (i = 0; i < CHAN_MAX ; i++) {
+ for (i = 0; i < CHAN_MAX; i++) {
_channel[i].avail = 0;
_tchannel[i].avail = 0;
}