diff options
author | Martin Kiewitz | 2015-05-30 21:01:59 +0200 |
---|---|---|
committer | Martin Kiewitz | 2015-05-30 21:01:59 +0200 |
commit | f3d1ffdaaf74b3ca1b01da16ec85d44d054e2f92 (patch) | |
tree | 17f5489fc78e4204fc2d6b2eb28731db4ed34da9 /engines/sherlock/scalpel/drivers | |
parent | 3dd81bfb355542f27a589ec1267fc495588e3734 (diff) | |
download | scummvm-rg350-f3d1ffdaaf74b3ca1b01da16ec85d44d054e2f92.tar.gz scummvm-rg350-f3d1ffdaaf74b3ca1b01da16ec85d44d054e2f92.tar.bz2 scummvm-rg350-f3d1ffdaaf74b3ca1b01da16ec85d44d054e2f92.zip |
SHERLOCK: adlib: add support for percussion
Diffstat (limited to 'engines/sherlock/scalpel/drivers')
-rw-r--r-- | engines/sherlock/scalpel/drivers/adlib.cpp | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/engines/sherlock/scalpel/drivers/adlib.cpp b/engines/sherlock/scalpel/drivers/adlib.cpp index 2a56d6a264..ca11012b1a 100644 --- a/engines/sherlock/scalpel/drivers/adlib.cpp +++ b/engines/sherlock/scalpel/drivers/adlib.cpp @@ -45,6 +45,24 @@ byte adlib_Operator2Register[SHERLOCK_ADLIB_VOICES_COUNT] = { 0x03, 0x04, 0x05, 0x0B, 0x0C, 0x0D, 0x13, 0x14, 0x15 }; +struct adlib_percussionChannelEntry { + byte requiredNote; + byte replacementNote; +}; + +// hardcoded, dumped from ADHOM.DRV +const adlib_percussionChannelEntry adlib_percussionChannelTable[SHERLOCK_ADLIB_VOICES_COUNT] = { + { 0x00, 0x00 }, + { 0x00, 0x00 }, + { 0x00, 0x00 }, + { 0x00, 0x00 }, + { 0x00, 0x00 }, + { 0x00, 0x00 }, + { 0x24, 0x0C }, + { 0x38, 0x01 }, + { 0x26, 0x1E } +}; + struct adlib_InstrumentEntry { byte reg20op1; byte reg40op1; @@ -433,8 +451,24 @@ void MidiDriver_AdLib::noteOn(byte MIDIchannel, byte note, byte velocity) { } } } + warning("MIDI channel not mapped/all FM voice channels busy %d", MIDIchannel); + } else { + // Percussion channel + warning("percussion!"); + for (byte FMvoiceChannel = 0; FMvoiceChannel < SHERLOCK_ADLIB_VOICES_COUNT; FMvoiceChannel++) { + if (_voiceChannelMapping[FMvoiceChannel] == MIDIchannel) { + if (note == adlib_percussionChannelTable[FMvoiceChannel].requiredNote) { + _channels[FMvoiceChannel].inUse = true; + _channels[FMvoiceChannel].currentNote = note; + + voiceOnOff(FMvoiceChannel, true, adlib_percussionChannelTable[FMvoiceChannel].replacementNote, velocity); + return; + } + } + } + // TODO: driver does some extra things in case no channel is found + warning("percussion MIDI channel not mapped/all FM voice channels busy"); } - warning("MIDI channel not mapped/all FM voice channels busy %d", MIDIchannel); } void MidiDriver_AdLib::noteOff(byte MIDIchannel, byte note) { @@ -444,7 +478,12 @@ void MidiDriver_AdLib::noteOff(byte MIDIchannel, byte note) { _channels[FMvoiceChannel].inUse = false; _channels[FMvoiceChannel].currentNote = 0; - voiceOnOff(FMvoiceChannel, false, note, 0); + if (MIDIchannel != 9) { + // not-percussion + voiceOnOff(FMvoiceChannel, false, note, 0); + } else { + voiceOnOff(FMvoiceChannel, false, adlib_percussionChannelTable[FMvoiceChannel].replacementNote, 0); + } return; } } |