/* GXY2SYX.c - A program to convert Rhodes Chroma program banks in Opcode */ /* Galaxy format into Chroma Cult sysex program dump files. */ /* */ /* Version 0.1 - written 18-SEP-99 by David Clarke */ /* (ac151@freenet.carleton.ca) */ /* Version 0.2 - updated 12-OCT-04 by D. Clarke */ /* (ac151@freenet.carleton.ca) */ /* corrected "%s" string formats in printf statements */ /* */ /* Please feel free to compile, change or do whatever you want with this */ /* utility; however, if you make any significant improvements I'd */ /* appreciate you e-mailing me a copy. Thanks! */ /* */ /* Syntax: */ /* GXY2SYX FILENAME */ /* */ /* The program will output 1 file called FILENAME.SYX */ /* For a properly formatted galaxy file, the resulting sysex file will be */ /* 5958 bytes. */ /* */ /* Comments: */ /* The Galaxy format was decoded imperically (i.e., I had no */ /* docs to show the exact Galaxy format). Aside from the fact */ /* that the Galaxy files contain a text-name description of the*/ /* patches, the data in the sysex files and Galaxy files are */ /* almost identical. The only other significant difference is */ /* that the Galaxy files store the data as bytes - whereas the */ /* Chroma Cult sysex is expressed as nibbles. */ /* */ /**************************************************************************/ #include #include #include #include /* Program-wide defines */ #define TRUE 1 #define FALSE 0 static char out[] = ".syx"; /* output file suffix */ char *f1name; /* full input file name */ char f2name[50]; /* full output file name */ FILE *f1, *f2; int main(int argc, char *argv[]) { int x, y; unsigned char byte1, byte2; y = 0; /* Current Program Number */ if (argc == 1) { printf("Syntax: GXY2SYX {filename} where filename is a galaxy file\n"); exit(0); } f1name = argv[1]; strncpy(f2name, f1name, strlen(f1name)); strcat(f2name, out); if ((f1 = fopen(f1name, "rb")) == NULL) { printf("Can't open %s\n", f1name); exit(0); } if ((f2 = fopen(f2name, "wb")) == NULL) { printf("Can't open %s\n", f2name); exit(0); } for (x = 1; x <= 65; ++x) /* Strip of Galaxy header info from file */ { byte1 = fgetc(f1); } /* Output Sysex Header Info */ fputc(0xF0, f2); /* Start of Sysex */ fputc(0x08, f2); /* Fender Manuf. ID */ fputc(0x00, f2); fputc(0x4B, f2); fputc(0x59, f2); /* Chroma Cult ID */ fputc(0x7F, f2); /* Indicate that this is a data dump, not a request */ fputc(0x33, f2); /* Indicate that this is a 50-program file */ while (!feof(f1) && (y < 50)) { for (x = 1; x <= 19; ++x) /* Strip of Galaxy Patch Name */ { byte1 = fgetc(f1); } y++; /* Increment current Patch Number */ fputc(y, f2); /* Output Patch Number */ for (x = 1; x <= 59; ++x) /* Process 59 bytes of Data */ { byte1 = fgetc(f1); /* Get Galaxy Data Byte */ fputc((byte1 & 0xF0) >> 4, f2); /* Output Top Nibble */ fputc(byte1 & 0x0F, f2); /* Output Lower Nibble */ } } fputc(0xF7, f2); /* Output an End of Sysex */ fclose(f1); /* Close Input File */ fclose(f2); /* Close Output File */ return(0); }