[Scummvm-cvs-logs] CVS: scummvm/scumm resource.cpp,1.134,1.135

Jochen Hoenicke hoenicke at users.sourceforge.net
Sat Aug 16 07:37:07 CEST 2003


Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv4855

Modified Files:
	resource.cpp 
Log Message:
Some Tempo changes for adlib sounds

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/resource.cpp,v
retrieving revision 1.134
retrieving revision 1.135
diff -u -d -r1.134 -r1.135
--- resource.cpp	16 Aug 2003 06:01:10 -0000	1.134
+++ resource.cpp	16 Aug 2003 14:30:23 -0000	1.135
@@ -1076,8 +1076,8 @@
 			
 		track = src_ptr;
 		
-		// Conver the ticks into a MIDI tempo. 
-		dw = (500000 * 256) / ticks;
+		// Convert the ticks into a MIDI tempo. 
+		dw = 0x7300000 / ticks;
 		debug(4, "  ticks = %d, speed = %ld", ticks, dw);
 			
 		// Write a tempo change SysEx
@@ -1175,12 +1175,12 @@
 			
 			// Now insert the jump. The jump offset is measured in ticks, and 
 			// each instrument definition spans 4 ticks... so we jump to tick
-			// 8*4, although jumping to tick 0 would probably work fine, too.
+			// num_instr*4, although jumping to tick 0 would probably work fine, too.
 			// Note: it's possible that some musics don't loop from the start...
 			// in that case we'll have to figure out how the loop range is specified
 			// and then how to handle it appropriately (if it's specified in
 			// ticks, we are fine; but if it's a byte offset, it'll be nasty).
-			const int jump_offset = 8 * 4;
+			const int jump_offset = num_instr * 4;
 			memcpy(ptr, "\xf0\x13\x7d\x30\00", 5); ptr += 5;	// maybe_jump
 			memcpy(ptr, "\x00\x00", 2); ptr += 2;			// cmd -> 0 means always jump
 			memcpy(ptr, "\x00\x00\x00\x00", 4); ptr += 4;	// track -> there is only one track, 0
@@ -1208,6 +1208,14 @@
 	int track_ctr = 0;
 	byte chunk_type = 0;
 
+	// Write a tempo change SysEx:
+	// 473 / 4 Hz, 480 pulses per quarternote, convert to micro seconds.
+	memcpy(ptr, "\x00\xFF\x51\x03", 4); ptr += 4;
+	dw = 1000000 * 480 * 4 / 473;
+	*ptr++ = (byte)((dw >> 16) & 0xFF);
+	*ptr++ = (byte)((dw >> 8) & 0xFF);
+	*ptr++ = (byte)(dw & 0xFF);
+
 	for (i = 0; i < 3; i++) {
 		track_time[i] = -1;
 		current_note[i] = -1;
@@ -1366,10 +1374,6 @@
 			}
 			*ptr++ = olddelay;
 
-
-			/* FIXME:  delay factor found by try and error */
-			delay = delay * 8;
-			
 			{
 				int freq = ((current_instr[ch][1] & 3) << 8)
 					| current_instr[ch][0];





More information about the Scummvm-git-logs mailing list