[Scummvm-cvs-logs] SF.net SVN: scummvm: [21162] scummvm/trunk/engines/kyra/sound_adlib.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Mar 9 04:06:00 CET 2006


Revision: 21162
Author:   eriktorbjorn
Date:     2006-03-09 04:04:41 -0800 (Thu, 09 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21162&view=rev

Log Message:
-----------
Corrected a few comments where I had mistaken the note on/off bit for one of
the octave bits.

The unkOuput1() function always turns off the note, so I've renamed it
noteOff(). I've added some comments to unkOuput2() as well, but I'm still not
quite sure what its purpose is. It seems unlikely that it's simply a "note on"
function, given the many things it will clear for the channel. It does end by
turning the note on, though. Strange.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/sound_adlib.cpp
Modified: scummvm/trunk/engines/kyra/sound_adlib.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound_adlib.cpp	2006-03-09 10:42:53 UTC (rev 21161)
+++ scummvm/trunk/engines/kyra/sound_adlib.cpp	2006-03-09 12:04:41 UTC (rev 21162)
@@ -150,7 +150,7 @@
 	void resetAdlibState();
 	void writeOPL(byte reg, byte val);
 	void initTable(OutputState &table);
-	void unkOutput1(OutputState &table);
+	void noteOff(OutputState &table);
 	void unkOutput2(uint8 num);
 
 	uint16 getRandomNr();
@@ -442,7 +442,7 @@
 		table.unk2 = 0;
 		table.dataptr = 0;
 		if (value != 9) {
-			unkOutput1(table);
+			noteOff(table);
 		}
 		++value;
 	}
@@ -566,9 +566,9 @@
 		if (table.unk4 < 0) {
 			if (--table.unk5) {
 				if (table.unk5 == table.unk7)
-					unkOutput1(table);
+					noteOff(table);
 				if (table.unk5 == table.unk3 && _curTable != 9)
-					unkOutput1(table);
+					noteOff(table);
 			} else {
 				int8 opcode = 0;
 				while (table.dataptr) {
@@ -652,8 +652,8 @@
 	table.unk3 = 0x01;
 }
 
-void AdlibDriver::unkOutput1(OutputState &table) {
-	debugC(9, kDebugLevelSound, "unkOutput1(%d)", &table - _outputTables);
+void AdlibDriver::noteOff(OutputState &table) {
+	debugC(9, kDebugLevelSound, "noteOff(%d)", &table - _outputTables);
 	if (_curTable == 9)
 		return;
 	if (_unk4 && _curTable >= 6)
@@ -684,8 +684,9 @@
 
 	// Octave / F-Number / Key-On
 
-	// The purpose of this seems to be to first clear everything, and then
-	// set the octave.
+	// Turn the note off, then turn it on again. This could be a "note on"
+	// function, but it also clears the octave and the part of the
+	// frequency (F-Number) stored in this register. Weird.
 
 	writeOPL(0xB0 + num, 0x00);
 	writeOPL(0xB0 + num, 0x20);
@@ -793,7 +794,7 @@
 
 void AdlibDriver::updateAndOutput3(OutputState &state) {
 	debugC(9, kDebugLevelSound, "updateAndOutput3(%d)", &state - _outputTables);
-	// This sets a bit in the "Octave" field
+	// This sets the "note on" bit.
 	state.unkOutputValue1 |= 0x20;
 
 	// Octave / F-Number / Key-On
@@ -1002,7 +1003,7 @@
 int AdlibDriver::updateCallback9(uint8 *&dataptr, OutputState &state, uint8 value) {
 	state.unk2 = 0;
 	if (_curTable != 9) {
-		unkOutput1(state);
+		noteOff(state);
 	}
 	dataptr = 0;
 	return 2;
@@ -1010,7 +1011,7 @@
 
 int AdlibDriver::updateCallback10(uint8 *&dataptr, OutputState &state, uint8 value) {
 	update1(value, state);
-	unkOutput1(state);
+	noteOff(state);
 	return (_continueFlag != 0);
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list