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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.26