diff options
author | Walter van Niftrik | 2009-05-25 12:38:20 +0000 |
---|---|---|
committer | Walter van Niftrik | 2009-05-25 12:38:20 +0000 |
commit | fcc45186a535e5387caa5cdb8a594ae7fff04f65 (patch) | |
tree | e6bb5727bdbb1a0711b7feff376edf62069a3685 /engines | |
parent | 4470dada57cffc23dd9b07a4667eecd04733b677 (diff) | |
download | scummvm-rg350-fcc45186a535e5387caa5cdb8a594ae7fff04f65.tar.gz scummvm-rg350-fcc45186a535e5387caa5cdb8a594ae7fff04f65.tar.bz2 scummvm-rg350-fcc45186a535e5387caa5cdb8a594ae7fff04f65.zip |
SCI: Adlib: fix crash in SQ4.
svn-id: r40886
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/sfx/softseq/adlib.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/engines/sci/sfx/softseq/adlib.cpp b/engines/sci/sfx/softseq/adlib.cpp index d788ea38d8..1b3180d9ea 100644 --- a/engines/sci/sfx/softseq/adlib.cpp +++ b/engines/sci/sfx/softseq/adlib.cpp @@ -443,17 +443,15 @@ void MidiDriver_Adlib::voiceOn(int voice, int note, int velocity) { _voices[voice].age = 0; - if (channel == 9) { + if ((channel == 9) && _rhythmKeyMap) { patch = CLIP(note, 27, 88) + 101; } else { patch = _channels[channel].patch; } // Set patch if different from current patch - if ((patch != _voices[voice].patch) && _playSwitch) { - _voices[voice].patch = patch; + if ((patch != _voices[voice].patch) && _playSwitch) setPatch(voice, patch); - } _voices[voice].velocity = velocity; setNote(voice, note, true); @@ -567,9 +565,10 @@ void MidiDriver_Adlib::setVelocityReg(int regOffset, int velocity, int kbScaleLe void MidiDriver_Adlib::setPatch(int voice, int patch) { if ((patch < 0) || ((uint)patch >= _patches.size())) { warning("ADLIB: Invalid patch %i requested", patch); - return; + patch = 0; } + _voices[voice].patch = patch; AdlibModulator &mod = _patches[patch].mod; // Set the common settings for both operators |