diff options
| author | drowe67 <[email protected]> | 2023-07-13 08:49:31 +0930 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2023-07-13 08:49:31 +0930 |
| commit | 3cd3a9f82068bea3a37e4efe0ee3752ecb044cce (patch) | |
| tree | 444f601b7a11731016cf6101d9d5d43950758330 /misc/raw2h.c | |
| parent | 153781e91a6f4d3c793518540acf7013510369f7 (diff) | |
rm misc directory
Diffstat (limited to 'misc/raw2h.c')
| -rw-r--r-- | misc/raw2h.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/misc/raw2h.c b/misc/raw2h.c deleted file mode 100644 index cb17f7c..0000000 --- a/misc/raw2h.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - raw2h.c - David Rowe - 10 April 2013 - - Converts a raw sound file to a C header file. Used for generating arrays to - test Codec2 on embedded systems without disk I/O. -*/ - -#include <assert.h> -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -int main(int argc, char *argv[]) { - FILE *fraw, *fheader; - int i, samples, ret; - short sam; - - if (argc != 5) { - printf("usage: %s inputRawFile outputHeaderFile arrayName samples\n", argv[0]); - exit(1); - } - - fraw = fopen(argv[1] ,"rb"); - assert(fraw != NULL); - fheader = fopen(argv[2],"wt"); - assert(fheader != NULL); - samples = atoi(argv[4]); - - fprintf(fheader, "short %s[] = {\n", argv[3]); - for(i=0; i<samples-1; i++) { - ret = fread(&sam, sizeof(short), 1, fraw); - assert(ret == 1); - fprintf(fheader, "%d,\n", sam); - } - ret = fread(&sam, sizeof(short), 1, fraw); - assert(ret == 1); - fprintf(fheader, "%d\n};\n", sam); - - fclose(fraw); - fclose(fheader); - - return 0; -} |
