]> hydra-www.ietfng.org Git - acmetensortoys-chiptunes/commitdiff
Tracker: remove export functionality
authorNathaniel Wesley Filardo <nwf@smaug.priv.ietfng.org>
Sun, 11 Apr 2010 08:40:00 +0000 (04:40 -0400)
committerNathaniel Wesley Filardo <nwf@smaug.priv.ietfng.org>
Sun, 11 Apr 2010 08:40:00 +0000 (04:40 -0400)
tracker/README
tracker/gui.c
tracker/main.c
tracker/stuff.h

index 28dc5752cff3ac42b9ebd511eeb73a91b43072a6..85d3b8ca108ae0efb39587290d336e47c5092d8a 100644 (file)
@@ -26,9 +26,7 @@ to enter notes. The keyboard layout is adapted for a US qwerty keymap. You can
 edit gui.c to change this to fit a Dvorak keymap instead.
 
 Press ^E (control-E) to exit without saving. Press ^W ("write") to save. Press
-# to optimize the song (remove unused tracks, move tracks together) and % to
-export the song into a packed format. (% will always export to two files called
-"exported.s" and "exported.h" in the current working directory).
+# to optimize the song (remove unused tracks, move tracks together).
 
 In the song and instrument editors, use capital A, I and D to add, insert and
 delete lines. In the track and instrument editors, use capital C and V for copy
index a03f50304e872ab4b3c793862799b00361b93f6f..1537fbf0a2bed5491f06c6c9a8c17b792c4dfa20 100644 (file)
@@ -428,174 +428,6 @@ void optimize() {
        }
 }
 
-static FILE *exportfile = 0;
-static int exportbits = 0;
-static int exportcount = 0;
-static int exportseek = 0;
-
-void putbit(int x) {
-       if(x) {
-               exportbits |= (1 << exportcount);
-       }
-       exportcount++;
-       if(exportcount == 8) {
-               if(exportfile) {
-                       fprintf(exportfile, "\t.byte\t0x%02x\n", exportbits);
-               }
-               exportseek++;
-               exportbits = 0;
-               exportcount = 0;
-       }
-}
-
-void exportchunk(int data, int bits) {
-       int i;
-
-       for(i = 0; i < bits; i++) {
-               putbit(!!(data & (1 << i)));
-       }
-}
-
-int alignbyte() {
-       if(exportcount) {
-               if(exportfile) {
-                       fprintf(exportfile, "\t.byte\t0x%02x\n", exportbits);
-               }
-               exportseek++;
-               exportbits = 0;
-               exportcount = 0;
-       }
-       if(exportfile) fprintf(exportfile, "\n");
-       return exportseek;
-}
-
-int packcmd(u8 ch) {
-       if(!ch) return 0;
-       if(strchr(validcmds, ch)) {
-               return strchr(validcmds, ch) - validcmds;
-       }
-       return 0;
-}
-
-void exportdata(FILE *f, int maxtrack, int *resources) {
-       int i, j;
-       int nres = 0;
-
-       exportfile = f;
-       exportbits = 0;
-       exportcount = 0;
-       exportseek = 0;
-
-       for(i = 0; i < 16 + maxtrack; i++) {
-        // if(exportfile) fprintf(exportfile, "songdata_resources%d:\n", i);
-               exportchunk(resources[i], PACKSIZE_RESOURCE);
-       }
-
-       resources[nres++] = alignbyte();
-
-    if(exportfile) fprintf(exportfile, "songdata_song:\n");
-       for(i = 0; i < songlen; i++) {
-               for(j = 0; j < NR_CHAN; j++) {
-                       if(song[i].transp[j]) {
-                               exportchunk(1, 1);
-                               exportchunk(song[i].track[j], PACKSIZE_SONGTRACK);
-                               exportchunk(song[i].transp[j], PACKSIZE_SONGTRANS);
-                       } else {
-                               exportchunk(0, 1);
-                               exportchunk(song[i].track[j], PACKSIZE_SONGTRACK);
-                       }
-               }
-       }
-
-       for(i = 1; i < 16; i++) {
-               resources[nres++] = alignbyte();
-
-        // if(exportfile) fprintf(exportfile, "songdata_instrument%d:\n", i);
-               if(instrument[i].length > 1) {
-                       for(j = 0; j < instrument[i].length; j++) {
-                               exportchunk(packcmd(instrument[i].line[j].cmd), PACKSIZE_INSTRCMD);
-                               exportchunk(instrument[i].line[j].param, PACKSIZE_INSTRPAR);
-                       }
-               }
-
-               exportchunk(0, PACKSIZE_INSTRCMD);
-       }
-
-       for(i = 1; i <= maxtrack; i++) {
-               resources[nres++] = alignbyte();
-
-        // if(exportfile) fprintf(exportfile, "songdata_track%d:\n", i);
-               for(j = 0; j < tracklen; j++) {
-                       u8 cmd = packcmd(track[i].line[j].cmd[0]);
-
-                       exportchunk(!!track[i].line[j].note, 1);
-                       exportchunk(!!track[i].line[j].instr, 1);
-                       exportchunk(!!cmd, 1);
-
-                       if(track[i].line[j].note) {
-                               exportchunk(track[i].line[j].note, PACKSIZE_TRACKNOTE);
-                       }
-
-                       if(track[i].line[j].instr) {
-                               exportchunk(track[i].line[j].instr, PACKSIZE_TRACKINST);
-                       }
-
-                       if(cmd) {
-                               exportchunk(cmd, PACKSIZE_TRACKCMD);
-                               exportchunk(track[i].line[j].param[0], PACKSIZE_TRACKPAR);
-                       }
-               }
-       }
-}
-
-void export(char *stem) {
-    int blen = strlen(stem) + 5;
-    char *buf = alloca(blen);
-    if(!buf) {
-        return;
-    }
-    snprintf(buf, blen, "%s.s", stem);
-       FILE *f = fopen(buf, "w");
-
-    snprintf(buf, blen, "%s.h", stem);
-       FILE *hf = fopen(buf, "w");
-
-       int i, j;
-       int maxtrack = 0;
-       int resources[256];
-
-       exportfile = 0;
-       exportbits = 0;
-       exportcount = 0;
-       exportseek = 0;
-
-       for(i = 0; i < songlen; i++) {
-               for(j = 0; j < 4; j++) {
-                       if(maxtrack < song[i].track[j]) maxtrack = song[i].track[j];
-               }
-       }
-
-       fprintf(f, "\t.global\tsongdata\n\n");
-
-       fprintf(hf, "#define MAXTRACK\t0x%02x\n", maxtrack);
-       fprintf(hf, "#define SONGLEN\t\t0x%02x\n", songlen);
-
-       fprintf(f, "songdata:\n");
-
-       exportdata(0, maxtrack, resources);
-
-       fprintf(f, "# ");
-       for(i = 0; i < 16 + maxtrack; i++) {
-               fprintf(f, "%04x ", resources[i]);
-       }
-       fprintf(f, "\n");
-
-       exportdata(f, maxtrack, resources);
-
-       fclose(f);
-       fclose(hf);
-}
-
 void handleinput() {
        int c, x;
        
@@ -662,9 +494,6 @@ void handleinput() {
                case '#':
                        optimize();
                        break;
-               case '%':
-                       export("export");
-                       break;
                case KEY_LEFT:
                        switch(currtab) {
                                case 0:
index 92a0a71c5be9df9700071840f203c461d41fe9ff..6c35954100198466a9053d067b4b6b6020ba7cff 100644 (file)
@@ -79,10 +79,6 @@ int main(int argc, char **argv) {
             fwrite(&res, 1, 1, f);
         }
         fclose(f);
-       } else if(!strcmp("--export", argv[1])) {
-               loadfile(argv[2]);
-        char *exportname = (argc > 2) ? argv[3] : "export" ;
-               export(exportname);
        } else {
                if(argc != 2) {
                        err(1, "usage: %s <filename>\n", argv[0]);
index feff1a3b9a866d983ddfdbe5dda47d51259e11b6..2cada60bdcda8bb7040ab040bbadebc2bf63c96f 100644 (file)
@@ -29,7 +29,6 @@ void guiloop();
 void startplaysong(int);
 void startplaytrack(int);
 void loadfile(char *);
-void export(char *);
 
 extern u8 trackpos;
 extern u8 playtrack;