Skip to content

Commit

Permalink
SHERLOCK: adlib: fix "in-use" usage voiceOnOff()
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Kiewitz committed May 30, 2015
1 parent 6ce9be2 commit 4942571
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions engines/sherlock/scalpel/drivers/adlib.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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];

Expand Down

0 comments on commit 4942571

Please sign in to comment.