2010-01-30 13:35:03 +00:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2001-05-25 18:17:27 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
// sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out
|
|
|
|
|
2007-06-27 23:04:36 +00:00
|
|
|
int main(void){
|
2001-05-25 18:17:27 +00:00
|
|
|
int i;
|
|
|
|
FILE *f;
|
|
|
|
|
|
|
|
f=fopen("alaw.dat","wb");
|
|
|
|
for(i=0;i<256;i++) fwrite(&i,1,1,f);
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
system("sox -t raw -A -r 8000 -b alaw.dat -t sw alaw.out");
|
|
|
|
|
2008-01-27 18:42:00 +00:00
|
|
|
printf("// Generated by TOOLS/alaw-gen.c\n\n");
|
|
|
|
|
2008-02-24 12:53:11 +00:00
|
|
|
printf("#ifndef MPLAYER_ALAW_H\n");
|
|
|
|
printf("#define MPLAYER_ALAW_H\n");
|
2001-05-25 18:17:27 +00:00
|
|
|
|
2008-01-27 18:38:47 +00:00
|
|
|
printf("\nconst short alaw2short[]={\n");
|
2001-05-25 18:17:27 +00:00
|
|
|
|
|
|
|
f=fopen("alaw.out","rb");
|
|
|
|
for(i=0;i<256;i++){
|
|
|
|
signed short x;
|
|
|
|
fread(&x,2,1,f);
|
2008-01-27 18:40:01 +00:00
|
|
|
printf("%7d",x);
|
2001-05-25 18:17:27 +00:00
|
|
|
if(i!=255) putchar(',');
|
|
|
|
if((i&7)==7) printf("\n");
|
|
|
|
}
|
|
|
|
fclose(f);
|
2001-05-25 18:19:53 +00:00
|
|
|
printf("};\n");
|
2001-05-25 18:17:27 +00:00
|
|
|
|
|
|
|
system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out");
|
|
|
|
|
2008-01-27 18:38:47 +00:00
|
|
|
printf("\nconst short ulaw2short[]={\n");
|
2001-05-25 18:17:27 +00:00
|
|
|
|
|
|
|
f=fopen("alaw.out","rb");
|
|
|
|
for(i=0;i<256;i++){
|
|
|
|
signed short x;
|
|
|
|
fread(&x,2,1,f);
|
2008-01-27 18:40:01 +00:00
|
|
|
printf("%7d",x);
|
2001-05-25 18:17:27 +00:00
|
|
|
if(i!=255) putchar(',');
|
|
|
|
if((i&7)==7) printf("\n");
|
|
|
|
}
|
|
|
|
fclose(f);
|
2008-01-27 18:42:00 +00:00
|
|
|
printf("};\n\n");
|
|
|
|
|
2008-02-24 12:53:11 +00:00
|
|
|
printf("#endif /* MPLAYER_ALAW_H */\n");
|
2001-05-25 18:17:27 +00:00
|
|
|
|
2007-06-27 13:04:29 +00:00
|
|
|
return 0;
|
2001-05-25 18:17:27 +00:00
|
|
|
}
|