aboutsummaryrefslogtreecommitdiff
path: root/engines/sherlock/scalpel/drivers
diff options
context:
space:
mode:
authorMartin Kiewitz2015-05-31 01:04:24 +0200
committerMartin Kiewitz2015-05-31 01:04:24 +0200
commit4942571e63589919dada0de3d225e78e60e6dcb6 (patch)
treea9398db2e8047ba3bfa6d454c67131ae27c33fca /engines/sherlock/scalpel/drivers
parent6ce9be24046b1cfd886d020758f083155a930155 (diff)
downloadscummvm-rg350-4942571e63589919dada0de3d225e78e60e6dcb6.tar.gz
scummvm-rg350-4942571e63589919dada0de3d225e78e60e6dcb6.tar.bz2
scummvm-rg350-4942571e63589919dada0de3d225e78e60e6dcb6.zip
SHERLOCK: adlib: fix "in-use" usage voiceOnOff()
Diffstat (limited to 'engines/sherlock/scalpel/drivers')
-rw-r--r--engines/sherlock/scalpel/drivers/adlib.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/engines/sherlock/scalpel/drivers/adlib.cpp b/engines/sherlock/scalpel/drivers/adlib.cpp
index 8dee5019f4..29ca1ba2bc 100644
--- a/engines/sherlock/scalpel/drivers/adlib.cpp
+++ b/engines/sherlock/scalpel/drivers/adlib.cpp
@@ -479,7 +479,9 @@ void MidiDriver_AdLib::noteOn(byte MIDIchannel, byte note, byte velocity) {
if (oldestInUseChannel >= 0) {
// channel found
warning("used In-Use channel");
- voiceOnOff(oldestInUseChannel, false, 0, 0);
+ // original driver used note 0, we use the current note
+ // because using note 0 could create a bad note (out of index) and we check that. Original driver didn't.
+ voiceOnOff(oldestInUseChannel, false, _channels[oldestInUseChannel].currentNote, 0);
_channels[oldestInUseChannel].inUse = true;
_channels[oldestInUseChannel].inUseTimer = 0; // safety, original driver also did this
@@ -542,7 +544,8 @@ void MidiDriver_AdLib::voiceOnOff(byte FMvoiceChannel, bool keyOn, byte note, by
frequencyOffset = note;
}
if (frequencyOffset >= SHERLOCK_ADLIB_NOTES_COUNT) {
- error("bad note!");
+ warning("CRITICAL - bad note!!!");
+ return;
}
frequency = adlib_FrequencyLookUpTable[frequencyOffset];