comparison 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
comparison
equal deleted inserted replaced
183:a65f0c3deaa7 184:50f55def91e5
7 */ 7 */
8 #include <stdio.h> 8 #include <stdio.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include "jss.h" 10 #include "jss.h"
11 #include "jssmod.h" 11 #include "jssmod.h"
12 #include "jssplr.h"
12 #include "dmlib.h" 13 #include "dmlib.h"
13 #include "dmargs.h" 14 #include "dmargs.h"
14 #include "dmres.h" 15 #include "dmres.h"
16
17 #define jmpNMODEffectTable (36)
18 static const char jmpMODEffectTable[jmpNMODEffectTable] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
15 19
16 20
17 char *srcFilename = NULL, *destFilename = NULL; 21 char *srcFilename = NULL, *destFilename = NULL;
18 BOOL optIgnoreErrors = FALSE, 22 BOOL optIgnoreErrors = FALSE,
19 optStripExtInstr = FALSE, 23 optStripExtInstr = FALSE,
864 JSSPattern *p = r->patterns[i]; 868 JSSPattern *p = r->patterns[i];
865 JSSNote *n = p->data; 869 JSSNote *n = p->data;
866 870
867 for (row = 0; row < p->nrows; row++) 871 for (row = 0; row < p->nrows; row++)
868 for (channel = 0; channel < p->nchannels; channel++, n++) 872 for (channel = 0; channel < p->nchannels; channel++, n++)
869 if (n->instrument >= 0 && n->instrument <= jsetMaxInstruments) 873 {
870 { 874 char effect;
871 n->instrument = mapExtInstruments[n->instrument]; 875
876 if (n->instrument >= 0 && n->instrument <= jsetMaxInstruments)
877 n->instrument = mapExtInstruments[n->instrument];
878
879 JMPGETEFFECT(effect, n->effect);
880
881 switch (effect)
882 {
883 case 'C': // Cxx = Set volume
884 if (n->volume == jsetNotSet)
885 {
886 n->volume = n->param;
887 n->effect = jsetNotSet;
888 n->param = jsetNotSet;
889 }
890 break;
891 }
872 } 892 }
873 } 893 }
874 894
875 // Remap orders list 895 // Remap orders list
876 for (i = 0; i < m->norders; i++) 896 for (i = 0; i < m->norders; i++)