home *** CD-ROM | disk | FTP | other *** search
- #include <stdlib.h>
- #include <stdio.h>
- #include <iostream.h>
- #include <math.h>
- #include <string.h>
-
-
- void write_file(char *filename, int channel,int value)
- {
- int check;
- FILE *fp;
-
- fp=fopen(filename,"wb");
- //header info
- putc(0xf0,fp);
- putc(0x41,fp);
- putc(0x10,fp);
- putc(0x42,fp);
- //commnad
- putc(0x12,fp);
- //data address
- putc(0x40,fp);
- putc(0x10+channel,fp);
- putc(0x16,fp);
- //data itself
- putc(value,fp);
- //checksum
- check=256-(0x40+0x16+0x10+channel+value);
- putc(check,fp);
- //end of sysx marker....
- putc(0xf7,fp);
- fclose(fp);
- }
-
-
- main()
- {
- char filename[15]="key";
- char target[15]="";
- int channel,value;
- for(int i=1; i<17;i++)
- {
- channel=i;
- if(i==10)
- channel=0;
- if(i>10)
- channel=i-1;
- for(value=0x28; value<=0x58; value+=4)
- {
- strcpy(filename,"");
- strcat(filename,itoa(i,target,10));
- strcat(filename,"key");
- if((value-64)<0)
- strcat(filename,"n");
- else
- strcat(filename,"p");
- strcat(filename,itoa((abs(value-64)),target,10));
- strcat(filename,".syx");
- cout<<filename<<'\n';
- write_file(filename,channel,value);
- }
- }
- }
-