changeset 1117:378e5914be1e

Improve dumpmod output some more.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 04 Mar 2015 03:30:28 +0200
parents 9d78c880c6e1
children de25e0f2b856
files Makefile.gen tools/dumpmod.c
diffstat 2 files changed, 62 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.gen	Wed Mar 04 02:04:40 2015 +0200
+++ b/Makefile.gen	Wed Mar 04 03:30:28 2015 +0200
@@ -19,7 +19,7 @@
 DM_CFLAGS += -I$(DMLIBSRC)
 
 ifeq ($(EXTRA_CFLAGS),)
-EXTRA_CFLAGS=-O3 -march=core2
+EXTRA_CFLAGS=-O3 -march=corei7
 endif
 
 
--- a/tools/dumpmod.c	Wed Mar 04 02:04:40 2015 +0200
+++ b/tools/dumpmod.c	Wed Mar 04 03:30:28 2015 +0200
@@ -122,6 +122,15 @@
 }
 
 
+const char *getNote(const int note)
+{
+    static char tmp[16];
+    snprintf(tmp, sizeof(tmp), "%s%d",
+        patNoteTable[note % 12], note / 12);
+    return tmp;
+}
+
+
 /* Print a given pattern
  */
 void printPattern(FILE *f, JSSPattern *p)
@@ -145,7 +154,7 @@
                 fprintf(f, "=== ");
                 break;
             default:
-                fprintf(f, "%s%i ", patNoteTable[n->note % 12], n->note / 12);
+                fprintf(f, "%s ", getNote(n->note));
                 break;
             }
 
@@ -233,15 +242,13 @@
 }
 
 
-void printExtInstrument(FILE *f, JSSExtInstrument *i)
+void printExtInstrument(FILE *f, JSSExtInstrument *inst)
 {
-    fprintf(f,
-        "Description: ");
 #ifndef JSS_LIGHT
-    if (i->desc && !optDump)
+    if (inst->desc && !optDump)
     {
         fprintf(f, "'");
-        printEscaped(f, i->desc);
+        printEscaped(f, inst->desc);
         fprintf(f, "'");
     }
 #endif
@@ -253,29 +260,42 @@
         "  vibratoDepth...: %i\n"
         "  vibratoRate....: %i\n"
         "  fadeOut........: %i\n",
-        i->nsamples, i->vibratoType, i->vibratoSweep,
-        i->vibratoDepth, i->vibratoRate, i->fadeOut);
+        inst->nsamples, inst->vibratoType, inst->vibratoSweep,
+        inst->vibratoDepth, inst->vibratoRate, inst->fadeOut);
 
     if (dmVerbosity >= 1)
     {
-        printEnvelope(f, &i->volumeEnv, "Volume");
-        printEnvelope(f, &i->panningEnv, "Panning");
+        printEnvelope(f, &inst->volumeEnv, "Volume");
+        printEnvelope(f, &inst->panningEnv, "Panning");
+    }
+    
+    if (dmVerbosity >= 2)
+    {
+        int n;
+        fprintf(f,
+        "  sNumForNotes: ");
+        for (n = 0; n < jsetNNotes; n++)
+        {
+            int snum = inst->sNumForNotes[n];
+            if (snum != jsetNotSet)
+            {
+                fprintf(f, "%s:%d ", getNote(n), snum);
+            }
+        }
     }
     fprintf(f, "\n");
 }
 
 
-void printInstrument(FILE *f, JSSInstrument *i)
+void printInstrument(FILE *f, JSSInstrument *inst)
 {
     if (dmVerbosity >= 1)
     {
-        fprintf(f,
-            "Description: ");
 #ifndef JSS_LIGHT
-        if (i->desc && !optDump)
+        if (inst->desc && !optDump)
         {
             fprintf(f, "'");
-            printEscaped(f, i->desc);
+            printEscaped(f, inst->desc);
             fprintf(f, "'");
         }
 #endif
@@ -286,46 +306,46 @@
             "  volume.........: %d (0x%x)\n"
             "  flags..........: 0x%x %s%s%s\n"
             "  C4BaseSpeed....: %d (0x%x)\n"
-            "  ERelNote.......: %s%d (%d)\n"
+            "  ERelNote.......: %s (%d)\n"
             "  EFineTune......: %d\n"
             "  EPanning.......: %d (0x%x)\n\n",
-            (unsigned long) i->size, (unsigned long) i->size,
-            (unsigned long) i->loopS, (unsigned long) i->loopE,
-            (unsigned long) i->loopS, (unsigned long) i->loopE,
-            i->volume, i->volume,
-            i->flags,
-            (i->flags & jsfLooped) ? "[loop]" : "",
-            (i->flags & jsfBiDi)   ? "[bi-di]" : "",
-            (i->flags & jsf16bit)  ? "[16 bit]" : "[8 bit]",
-            i->C4BaseSpeed, i->C4BaseSpeed,
-            patNoteTable[(48 + i->ERelNote) % 12], (48 + i->ERelNote) / 12, i->ERelNote,
-            i->EFineTune, i->EPanning, i->EPanning);
+            (unsigned long) inst->size, (unsigned long) inst->size,
+            (unsigned long) inst->loopS, (unsigned long) inst->loopE,
+            (unsigned long) inst->loopS, (unsigned long) inst->loopE,
+            inst->volume, inst->volume,
+            inst->flags,
+            (inst->flags & jsfLooped) ? "[loop]" : "",
+            (inst->flags & jsfBiDi)   ? "[bi-di]" : "",
+            (inst->flags & jsf16bit)  ? "[16 bit]" : "[8 bit]",
+            inst->C4BaseSpeed, inst->C4BaseSpeed,
+            getNote(inst->ERelNote + 48), inst->ERelNote,
+            inst->EFineTune, inst->EPanning, inst->EPanning);
     }
     else
     {
 #ifndef JSS_LIGHT
-        if (i->desc && !optDump)
+        if (inst->desc && !optDump)
         {
-            printEscaped(f, i->desc);
+            printEscaped(f, inst->desc);
             fprintf(f, "|");
         }
 #endif
         fprintf(f,
             "%8ld|%8ld..%-8ld|%03d|%-2s %-2s %-2s|"
-            "%4d|%s%d|%d|%d\n",
-            (unsigned long) i->size,
-            (unsigned long) i->loopS,
-            (unsigned long) i->loopE,
-            i->volume,
+            "%4d|%s%d|%4d|%4d\n",
+            (unsigned long) inst->size,
+            (unsigned long) inst->loopS,
+            (unsigned long) inst->loopE,
+            inst->volume,
 
-            (i->flags & jsfLooped) ? "lp" : "",
-            (i->flags & jsfBiDi)   ? "bi" : "",
-            (i->flags & jsf16bit)  ? "16" : "8",
+            (inst->flags & jsfLooped) ? "lp" : "",
+            (inst->flags & jsfBiDi)   ? "bi" : "",
+            (inst->flags & jsf16bit)  ? "16" : "8",
 
-            i->C4BaseSpeed,
-            patNoteTable[(48 + i->ERelNote) % 12],
-            (48 + i->ERelNote) / 12, i->EFineTune,
-            i->EPanning);
+            inst->C4BaseSpeed,
+            patNoteTable[(48 + inst->ERelNote) % 12],
+            (48 + inst->ERelNote) / 12, inst->EFineTune,
+            inst->EPanning);
     }
 }