# HG changeset patch # User Mychaela Falconia # Date 1627604585 0 # Node ID 516066ac5bc1c18101ff26c426d2631988a9ddc9 # Parent c458e33060bf99dfcf968e9092e2463d76093e98 tiaud-decomp: support both old-AEC and new-AEC mode files diff -r c458e33060bf -r 516066ac5bc1 ffstools/tiaud/decomp.c --- a/ffstools/tiaud/decomp.c Fri Jul 30 00:10:13 2021 +0000 +++ b/ffstools/tiaud/decomp.c Fri Jul 30 00:23:05 2021 +0000 @@ -14,6 +14,7 @@ #include "binstruct.h" struct audio_cfg_bin bin; +int is_new_aec; FILE *outf; read_bin_file(filename) @@ -32,11 +33,15 @@ fprintf(stderr, "%s is not a regular file\n", filename); exit(1); } - if (st.st_size != MODE_FILE_SIZE_OLDAEC) { + if (st.st_size == MODE_FILE_SIZE_OLDAEC) + is_new_aec = 0; + else if (st.st_size == MODE_FILE_SIZE_NEWAEC) + is_new_aec = 1; + else { fprintf(stderr, "%s has the wrong length\n", filename); exit(1); } - read(fd, &bin, MODE_FILE_SIZE_OLDAEC); + read(fd, &bin, st.st_size); close(fd); } @@ -56,7 +61,7 @@ emit_ascii() { - int i; + int i, num_aec; fprintf(outf, "voice-path %u\n", bin.voice_path); @@ -114,8 +119,14 @@ fputs("}\n", outf); fprintf(outf, "sidetone %d\n", bin.sidetone_gain); - fputs("aec", outf); - for (i = 0; i < 5; i++) { + if (is_new_aec) { + fputs("aec-new", outf); + num_aec = 12; + } else { + fputs("aec", outf); + num_aec = 5; + } + for (i = 0; i < num_aec; i++) { putc(' ', outf); if (bin.aec_words[i]) fprintf(outf, "0x%X", le16toh(bin.aec_words[i]));