shithub: dumb

Download patch

ref: 5b36c39238d02c7f1fa8df791ae54935830300ca
parent: 7a0d05c002c7ced72ceba489fc603b10b6d72d2b
author: Chris Moeller <[email protected]>
date: Fri Apr 11 12:34:13 EDT 2014

Adjusted tempo timing a bit, now rounding samples per tick down instead of up

--- a/dumb/include/internal/it.h
+++ b/dumb/include/internal/it.h
@@ -73,10 +73,9 @@
 #define IT_INSM_SIGNATURE       DUMB_ID('M', 'S', 'N', 'I')
 
 
-/* 1 minute per 4 rows, each row 6 ticks; this is divided by the tempo to get
- * the interval between ticks.
+/* This is divided by the tempo times 256 to get the interval between ticks.
  */
-#define TICK_TIME_DIVIDEND ((65536 * 60) / (4 * 6))
+#define TICK_TIME_DIVIDEND (65536 * 5 * 128)
 
 
 
--- a/dumb/src/it/itrender.c
+++ b/dumb/src/it/itrender.c
@@ -751,28 +751,12 @@
 static inline void
 __cpuid(int *data, int selector)
 {
-#if defined(__PIC__) && defined(__i386__)
-    asm("xchgl %%ebx, %%esi; cpuid; xchgl %%ebx, %%esi"
-        : "=a" (data[0]),
-        "=S" (data[1]),
-        "=c" (data[2]),
-        "=d" (data[3])
-        : "0" (selector));
-#elif defined(__PIC__) && defined(__amd64__)
-    asm("xchg{q} {%%}rbx, %q1; cpuid; xchg{q} {%%}rbx, %q1"
-        : "=a" (data[0]),
-        "=&r" (data[1]),
-        "=c" (data[2]),
-        "=d" (data[3])
-        : "0" (selector));
-#else
     asm("cpuid"
         : "=a" (data[0]),
         "=b" (data[1]),
         "=c" (data[2]),
         "=d" (data[3])
-        : "0" (selector));
-#endif
+        : "a"(selector));
 }
 #else
 #define __cpuid(a,b) memset((a), 0, sizeof(int) * 4)
@@ -4040,7 +4024,7 @@
 	DUMB_IT_SIGDATA *sigdata = sigrenderer->sigdata;
 	int i;
 
-	float invt2g = 1.0f / ((float)TICK_TIME_DIVIDEND / (float)sigrenderer->tempo);
+	float invt2g = 1.0f / ((float)TICK_TIME_DIVIDEND / (float)sigrenderer->tempo / 256.0f);
 
 	for (i = 0; i < DUMB_IT_N_CHANNELS; i++) {
 		IT_CHANNEL *channel = &sigrenderer->channel[i];
@@ -4447,7 +4431,7 @@
 
 	if (sigrenderer->globalvolume == 0) {
 		if (sigrenderer->callbacks->global_volume_zero) {
-			LONG_LONG t = sigrenderer->gvz_sub_time + ((LONG_LONG)TICK_TIME_DIVIDEND << 16) / sigrenderer->tempo;
+			LONG_LONG t = sigrenderer->gvz_sub_time + ((TICK_TIME_DIVIDEND / (sigrenderer->tempo << 8)) << 16);
 			sigrenderer->gvz_time += (int)(t >> 16);
 			sigrenderer->gvz_sub_time = (int)t & 65535;
 			if (sigrenderer->gvz_time >= 65536 * 12) {
@@ -4468,7 +4452,7 @@
 	process_all_playing(sigrenderer);
 
 	{
-		LONG_LONG t = ((LONG_LONG)TICK_TIME_DIVIDEND << 16) / sigrenderer->tempo;
+		LONG_LONG t = (TICK_TIME_DIVIDEND / (sigrenderer->tempo << 8)) << 16;
 		if ( sigrenderer->sigdata->flags & IT_WAS_AN_STM ) {
 			t /= 16;
 		}
@@ -4484,6 +4468,7 @@
 
 int dumb_it_max_to_mix = 64;
 
+#if 0
 static const int aiMODVol[] =
 {
 	0,
@@ -4496,6 +4481,7 @@
 		785, 801, 817, 833, 849, 865, 881, 897,
 		913, 929, 945, 961, 977, 993, 1009, 1024
 };
+#endif
 
 static const int aiPTMVolScaled[] =
 {