]> hydra-www.ietfng.org Git - acmetensortoys-chiptunes/commitdiff
Eliminate character command encoding in target
authorNathaniel Wesley Filardo <nwf@smaug.priv.ietfng.org>
Mon, 1 Mar 2010 00:50:55 +0000 (19:50 -0500)
committerNathaniel Wesley Filardo <nwf@smaug.priv.ietfng.org>
Mon, 1 Mar 2010 00:50:55 +0000 (19:50 -0500)
While here, fix a permutation in progenv/trackerfmt.h's CMD_* definitions.

progenv/trackerfmt.h
target/main.c

index 0a818af8c0e60d255fc768bf7321cd8db72da889..e33d0e33c53b79e7fd32e365894302d978122631 100644 (file)
@@ -21,7 +21,7 @@
     /** Set channel volume derivative */
 #define CMD_VOLUMED     0x2
     /** Set channel inertia (param << 1) */
-#define CMD_INTERTIA    0x3
+#define CMD_INERTIA     0x3
     /** Set channel instrument offset */
 #define CMD_IJUMP       0x4
     /** Set channel bend derivative */
     /** Set oscillator waveform */
 #define CMD_WAVEFORM    0x9
     /** Set channel instrument note (transposed) */
-#define CMD_INOTETRANS  0xA     
+#define CMD_INOTETRANS  0xB
     /** Set channel instrument note (absolute) */
-#define CMD_INOTE       0xB
+#define CMD_INOTE       0xC
     /** Set channel vibrato depth and rate */
-#define CMD_VIBRATO     0xC
+#define CMD_VIBRATO     0xA
 
     /* RESERVED 0x0D */
     /* RESERVED 0x0E */
index 4f91fcb68446239b6c774ac85602ce83116bc768..4acbaf8f3c1f128be1d3b7c36aa8241e9ad8ef1e 100644 (file)
@@ -25,8 +25,6 @@ u32 noiseseed = 1;
 
 u8 light[2];
 
-const u8 validcmds[] = "0dfijlmtvw~+=";
-
 volatile struct oscillator {
        u16     freq;
        u16     phase;
@@ -119,44 +117,44 @@ void readinstr(u8 num, u8 pos, u8 *dest) {
 }
 
 void runcmd(u8 ch, u8 cmd, u8 param) {
-       switch(validcmds[cmd]) {
-               case '0':
+       switch(cmd) {
+               case CMD_ISTOP:
                        channel[ch].inum = 0;
                        break;
-               case 'd':
+               case CMD_DUTY:
                        osc[ch].duty = param << 8;
                        break;
-               case 'f':
+               case CMD_VOLUMED:
                        channel[ch].volumed = param;
                        break;
-               case 'i':
+               case CMD_INERTIA:
                        channel[ch].inertia = param << 1;
                        break;
-               case 'j':
+               case CMD_IJUMP:
                        channel[ch].iptr = param;
                        break;
-               case 'l':
+               case CMD_BENDD:
                        channel[ch].bendd = param;
                        break;
-               case 'm':
+               case CMD_DUTYD:
                        channel[ch].dutyd = param << 6;
                        break;
-               case 't':
+               case CMD_IWAIT:
                        channel[ch].iwait = param;
                        break;
-               case 'v':
+               case CMD_VOLUME:
                        osc[ch].volume = param;
                        break;
-               case 'w':
+               case CMD_WAVEFORM:
                        osc[ch].waveform = param;
                        break;
-               case '+':
+               case CMD_INOTETRANS:
                        channel[ch].inote = param + channel[ch].tnote - 12 * 4;
                        break;
-               case '=':
+               case CMD_INOTE:
                        channel[ch].inote = param;
                        break;
-               case '~':
+               case CMD_VIBRATO:
                        if(channel[ch].vdepth != (param >> 4)) {
                                channel[ch].vpos = 0;
                        }