|
|
1.1 root 1: /* CVT$$A*/
2:
3: /* Converts OS/2 tune editor files to tone format */
4:
5: #include <stdio.h>
6: #include <stdlib.h>
7:
8: void main()
9: {
10: char str[128]
11: ,*note="abcdefgabcdefgabcdefgabcdefg"
12: ,*flat="GABCDEFGABCDEFGABCDEFGABCDEFG";
13: unsigned int bt=200,o,n,t,i;
14:
15: while(1) {
16: fprintf(stderr,"top\n");
17: if(!fgets(str,81,stdin))
18: break;
19: if(str[1]==':') {
20: printf("%s",str+1);
21: continue; }
22: if(str[2]!=' ') {
23: str[4]=0;
24: bt=atoi(str);
25: continue; }
26: t=atoi(str);
27: if(!t)
28: continue;
29: fprintf(stderr,"rest\n");
30: if(t>=10) {
31: if(t==10)
32: t=bt*4;
33: else if(t==11)
34: t=bt*2;
35: else if(t==12)
36: t=bt;
37: else if(t==13)
38: t=bt/2;
39: else if(t==14)
40: t=bt/4;
41: else if(t==14)
42: t=bt/8;
43: printf("r %u\n",t);
44: continue; }
45: fprintf(stderr,"time\n");
46: t=(bt*4)/t;
47: i=atoi(str+3);
48: o=2;
49: fprintf(stderr,"note\n");
50: if(i<=20) {
51: n=note[20-i];
52: if(20-i)
53: o+=((20-i)/7); }
54: else if(i<=41) { /* flats */
55: n=flat[41-i];
56: if(41-i)
57: o+=((41-i)/7); }
58: else {
59: n=toupper(note[62-i]);
60: if(62-i)
61: o+=((62-i)/7); }
62: if(toupper(n)=='A' || toupper(n)=='B' || n=='G')
63: o--;
64: printf("%c%u %u\n",n,o,t); }
65: }
66:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.