/[projet1]/public/pc/tools/oric/4k8/4k8towav.c
Defence Force logotype

Annotation of /public/pc/tools/oric/4k8/4k8towav.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 829 - (hide annotations)
Thu Apr 26 21:22:08 2012 UTC (8 years, 1 month ago) by mmu_man
File MIME type: text/plain
File size: 1272 byte(s)
Fix warnings.

1 dbug 21 #include <stdio.h>
2 mmu_man 829 #include <stdlib.h>
3    
4 dbug 21 FILE *fd, *fd2;
5     struct {
6     char sig[4];
7     int riff_size;
8     char datasig[4];
9     char fmtsig[4];
10     int fmtsize;
11     short tag;
12     short channels;
13     int freq;
14     int bytes_per_sec;
15     short byte_per_sample;
16     short bits_per_sample;
17     char samplesig[4];
18     int length;
19     } sample_riff= {"RIFF",0,"WAVE","fmt ",16,1,1,4800,4800,1,8,"data",0};
20    
21     main(int argc,char *argv[])
22     {
23     int i,c,size;
24    
25     if (argc!=3) {
26     printf("Usage: oric2wav <tape_image> <wav_file>\n");
27     exit(1);
28     }
29     fd=fopen(argv[1],"rb");
30     if (fd==NULL) {
31     printf("Unable to open %s\n",argv[1]);
32     exit(1);
33     }
34     fd2=fopen(argv[2],"wb");
35     if (fd2==NULL) {
36     printf("Unable to open %s\n",argv[2]);
37     exit(1);
38     }
39     fseek(fd,0,SEEK_END); size=ftell(fd); fseek(fd,0,SEEK_SET);
40     sample_riff.length=size*8;
41     sample_riff.riff_size=sample_riff.length+36;
42     fwrite(&sample_riff,1,sizeof(sample_riff),fd2);
43     for(i=0;i<size;i++) {
44     c=fgetc(fd);
45     fputc(c&0x80?0xE0:0x20,fd2);
46     fputc(c&0x40?0xE0:0x20,fd2);
47     fputc(c&0x20?0xE0:0x20,fd2);
48     fputc(c&0x10?0xE0:0x20,fd2);
49     fputc(c&0x08?0xE0:0x20,fd2);
50     fputc(c&0x04?0xE0:0x20,fd2);
51     fputc(c&0x02?0xE0:0x20,fd2);
52     fputc(c&0x01?0xE0:0x20,fd2);
53     }
54     }
55    

  ViewVC Help
Powered by ViewVC 1.1.26