[Scummvm-cvs-logs] scummvm master -> 0a6f67a36e1d43614fd58e8865b4a3e9beb81558

m-kiewitz m_kiewitz at users.sourceforge.net
Sat May 30 20:59:50 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0a6f67a36e SHERLOCK: adlib: add support for percussion


Commit: 0a6f67a36e1d43614fd58e8865b4a3e9beb81558
    https://github.com/scummvm/scummvm/commit/0a6f67a36e1d43614fd58e8865b4a3e9beb81558
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2015-05-30T21:01:59+02:00

Commit Message:
SHERLOCK: adlib: add support for percussion

Changed paths:
    engines/sherlock/scalpel/drivers/adlib.cpp



diff --git a/engines/sherlock/scalpel/drivers/adlib.cpp b/engines/sherlock/scalpel/drivers/adlib.cpp
index 2a56d6a..ca11012 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;
 			}
 		}






More information about the Scummvm-git-logs mailing list