annotate TOOLS/alaw-gen.c @ 26569:a92ab298a11f

Rebuild version.h only when the working directory was updated.
author diego
date Wed, 30 Apr 2008 10:57:45 +0000
parents 044b3c830459
children b573c7c7173b
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
25865
b1316c443f87 Add multiple inclusion guards to generated header file.
diego
parents: 25864
diff changeset
16 printf("// Generated by TOOLS/alaw-gen.c\n\n");
b1316c443f87 Add multiple inclusion guards to generated header file.
diego
parents: 25864
diff changeset
17
26057
044b3c830459 Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents: 25865
diff changeset
18 printf("#ifndef MPLAYER_ALAW_H\n");
044b3c830459 Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents: 25865
diff changeset
19 printf("#define MPLAYER_ALAW_H\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
20
25863
3bb953467710 The alaw tables should be const.
diego
parents: 23662
diff changeset
21 printf("\nconst short alaw2short[]={\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
22
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
23 f=fopen("alaw.out","rb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
24 for(i=0;i<256;i++){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
25 signed short x;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
26 fread(&x,2,1,f);
25864
ae6c30322f95 Change format string so that the table is nicely aligned.
diego
parents: 25863
diff changeset
27 printf("%7d",x);
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
28 if(i!=255) putchar(',');
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
29 if((i&7)==7) printf("\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
30 }
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
31 fclose(f);
880
714bc8aadb68 missing semicolon fixed
arpi_esp
parents: 879
diff changeset
32 printf("};\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
33
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
34 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
35
25863
3bb953467710 The alaw tables should be const.
diego
parents: 23662
diff changeset
36 printf("\nconst short ulaw2short[]={\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
37
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
38 f=fopen("alaw.out","rb");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
39 for(i=0;i<256;i++){
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
40 signed short x;
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
41 fread(&x,2,1,f);
25864
ae6c30322f95 Change format string so that the table is nicely aligned.
diego
parents: 25863
diff changeset
42 printf("%7d",x);
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
43 if(i!=255) putchar(',');
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
44 if((i&7)==7) printf("\n");
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
45 }
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
46 fclose(f);
25865
b1316c443f87 Add multiple inclusion guards to generated header file.
diego
parents: 25864
diff changeset
47 printf("};\n\n");
b1316c443f87 Add multiple inclusion guards to generated header file.
diego
parents: 25864
diff changeset
48
26057
044b3c830459 Add MPLAYER_ prefix to multiple inclusion guard of generated file.
diego
parents: 25865
diff changeset
49 printf("#endif /* MPLAYER_ALAW_H */\n");
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
50
23659
f15f95c2671a Fix "control reaches end of non-void function" warnings.
diego
parents: 880
diff changeset
51 return 0;
879
5d00233a4e5b alaw and ulaw table generator
arpi_esp
parents:
diff changeset
52 }