diff xm2jss.c @ 184:50f55def91e5

Add a minor optimization in the conversion.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 06 Oct 2012 15:10:49 +0300
parents 7108681151a4
children 85614db5f577
line wrap: on
line diff
--- a/xm2jss.c	Sat Oct 06 14:58:29 2012 +0300
+++ b/xm2jss.c	Sat Oct 06 15:10:49 2012 +0300
@@ -9,10 +9,14 @@
 #include <errno.h>
 #include "jss.h"
 #include "jssmod.h"
+#include "jssplr.h"
 #include "dmlib.h"
 #include "dmargs.h"
 #include "dmres.h"
 
+#define jmpNMODEffectTable (36)
+static const char jmpMODEffectTable[jmpNMODEffectTable] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+
 
 char  *srcFilename = NULL, *destFilename = NULL;
 BOOL  optIgnoreErrors = FALSE,
@@ -866,9 +870,25 @@
         
         for (row = 0; row < p->nrows; row++)
         for (channel = 0; channel < p->nchannels; channel++, n++)
-        if (n->instrument >= 0 && n->instrument <= jsetMaxInstruments)
         {
-            n->instrument = mapExtInstruments[n->instrument];
+            char effect;
+
+            if (n->instrument >= 0 && n->instrument <= jsetMaxInstruments)
+                n->instrument = mapExtInstruments[n->instrument];
+            
+            JMPGETEFFECT(effect, n->effect);
+            
+            switch (effect)
+            {
+                case 'C': // Cxx = Set volume
+                    if (n->volume == jsetNotSet)
+                    {
+                        n->volume = n->param;
+                        n->effect = jsetNotSet;
+                        n->param = jsetNotSet;
+                    }
+                    break;
+            }
         }
     }