FreeCalypso > hg > freecalypso-tools
comparison ffstools/tiaud/compile.c @ 836:f7e946389f8b
tiaud-compile: add support for aec-new
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 30 Jul 2021 00:50:47 +0000 |
parents | c458e33060bf |
children |
comparison
equal
deleted
inserted
replaced
835:516066ac5bc1 | 836:f7e946389f8b |
---|---|
14 #include <stdlib.h> | 14 #include <stdlib.h> |
15 #include <unistd.h> | 15 #include <unistd.h> |
16 #include "binstruct.h" | 16 #include "binstruct.h" |
17 | 17 |
18 struct audio_cfg_bin bin; | 18 struct audio_cfg_bin bin; |
19 int is_new_aec; | |
19 | 20 |
20 char *infname; | 21 char *infname; |
21 FILE *inf; | 22 FILE *inf; |
22 int lineno; | 23 int lineno; |
23 | 24 |
560 } | 561 } |
561 bin.sidetone_gain = strtol_wrap(np); | 562 bin.sidetone_gain = strtol_wrap(np); |
562 } | 563 } |
563 | 564 |
564 static void | 565 static void |
565 aec_setting(args) | 566 aec_setting(name, nwords, args) |
566 char *args; | 567 char *name, *args; |
567 { | 568 { |
568 char *cp, *np; | 569 char *cp, *np; |
569 int n; | 570 int n; |
570 | 571 |
571 cp = args; | 572 cp = args; |
572 for (n = 0; n < 5; n++) { | 573 for (n = 0; n < nwords; n++) { |
573 while (isspace(*cp)) | 574 while (isspace(*cp)) |
574 cp++; | 575 cp++; |
575 if (*cp == '\0' || *cp == '#') { | 576 if (*cp == '\0' || *cp == '#') { |
576 argcount_err: fprintf(stderr, | 577 argcount_err: fprintf(stderr, |
577 "%s line %d: aec setting takes 5 arguments\n", | 578 "%s line %d: %s setting takes %d arguments\n", |
578 infname, lineno); | 579 infname, lineno, name, nwords); |
579 exit(1); | 580 exit(1); |
580 } | 581 } |
581 for (np = cp; *cp && !isspace(*cp); cp++) | 582 for (np = cp; *cp && !isspace(*cp); cp++) |
582 ; | 583 ; |
583 if (*cp) | 584 if (*cp) |
610 mic_head_line(cp); | 611 mic_head_line(cp); |
611 else if (!strcmp(np, "speaker")) | 612 else if (!strcmp(np, "speaker")) |
612 speaker_head_line(cp); | 613 speaker_head_line(cp); |
613 else if (!strcmp(np, "sidetone")) | 614 else if (!strcmp(np, "sidetone")) |
614 sidetone_setting(cp); | 615 sidetone_setting(cp); |
615 else if (!strcmp(np, "aec")) | 616 else if (!strcmp(np, "aec")) { |
616 aec_setting(cp); | 617 is_new_aec = 0; |
617 else { | 618 aec_setting("aec", 5, cp); |
619 } else if (!strcmp(np, "aec-new")) { | |
620 is_new_aec = 1; | |
621 aec_setting("aec-new", 12, cp); | |
622 } else { | |
618 fprintf(stderr, | 623 fprintf(stderr, |
619 "%s line %d: unknown top-level setting \"%s\"\n", | 624 "%s line %d: unknown top-level setting \"%s\"\n", |
620 infname, lineno, np); | 625 infname, lineno, np); |
621 exit(1); | 626 exit(1); |
622 } | 627 } |
631 fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666); | 636 fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666); |
632 if (fd < 0) { | 637 if (fd < 0) { |
633 perror(filename); | 638 perror(filename); |
634 exit(1); | 639 exit(1); |
635 } | 640 } |
636 write(fd, &bin, MODE_FILE_SIZE_OLDAEC); | 641 write(fd, &bin, |
642 is_new_aec ? MODE_FILE_SIZE_NEWAEC : MODE_FILE_SIZE_OLDAEC); | |
637 close(fd); | 643 close(fd); |
638 } | 644 } |
639 | 645 |
640 main(argc, argv) | 646 main(argc, argv) |
641 char **argv; | 647 char **argv; |