annotate TOOLS/alaw-gen.c @ 25765:304fc0bbefe1

audio_out / video_out structs should be treated as const
author reimar
date Sat, 19 Jan 2008 11:33:36 +0000
parents 5c5fb6af79d1
children 3bb953467710
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
1 #include <stdio.h>
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
2 #include <stdlib.h>
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
3
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
4 // sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
5
23662
5c5fb6af79d1 Mark main() function as a function that takes no parameters.
diego
parents: 23659
diff changeset
6 int main(void){
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
7 int i;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
8 FILE *f;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
9
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
10 f=fopen("alaw.dat","wb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
11 for(i=0;i<256;i++) fwrite(&i,1,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
12 fclose(f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
13
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
14 system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
15
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
16 printf("// Generated by TOOLS/alaw-gen.c\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
17
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
18 printf("\nshort alaw2short[]={\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
19
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
20 f=fopen("alaw.out","rb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
21 for(i=0;i<256;i++){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
22 signed short x;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
23 fread(&x,2,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
24 printf("%6d",x);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
25 if(i!=255) putchar(',');
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
26 if((i&7)==7) printf("\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
27 }
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
28 fclose(f);
880
714bc8aadb68 missing semicolon fixed
arpi_esp
parents: 879
diff changeset
29 printf("};\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
30
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
31 system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
32
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
33 printf("\nshort ulaw2short[]={\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
34
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
35 f=fopen("alaw.out","rb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
36 for(i=0;i<256;i++){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
37 signed short x;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
38 fread(&x,2,1,f);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
39 printf("%6d",x);
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
40 if(i!=255) putchar(',');
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
41 if((i&7)==7) printf("\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
42 }
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
43 fclose(f);
880
714bc8aadb68 missing semicolon fixed
arpi_esp
parents: 879
diff changeset
44 printf("};\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
45
23659
f15f95c2671a Fix "control reaches end of non-void function" warnings.
diego
parents: 880
diff changeset
46 return 0;
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
47 }