Mercurial > mplayer.hg
view TOOLS/alaw-gen.c @ 15536:b39eee207c42
LANG=C ensures month/day order and English language in the date string for
more reliable operation in diverse environments. Tested on OpenBSD, NetBSD,
FreeBSD, Darwin 10.2 and Darwin 10.1. Darwin 10.4 should work as well, 10.3
does not due to broken ls.
author | diego |
---|---|
date | Sat, 21 May 2005 14:44:10 +0000 |
parents | 714bc8aadb68 |
children | f15f95c2671a |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> // sox -t raw -A -r 8000 -b alaw.alaw -t sw alaw.out int main(){ 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"); printf("// Generated by TOOLS/alaw-gen.c\n"); printf("\nshort alaw2short[]={\n"); f=fopen("alaw.out","rb"); for(i=0;i<256;i++){ signed short x; fread(&x,2,1,f); printf("%6d",x); if(i!=255) putchar(','); if((i&7)==7) printf("\n"); } fclose(f); printf("};\n"); system("sox -t raw -U -r 8000 -b alaw.dat -t sw alaw.out"); printf("\nshort ulaw2short[]={\n"); f=fopen("alaw.out","rb"); for(i=0;i<256;i++){ signed short x; fread(&x,2,1,f); printf("%6d",x); if(i!=255) putchar(','); if((i&7)==7) printf("\n"); } fclose(f); printf("};\n"); }