diff 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
line wrap: on
line diff
--- a/ffstools/tiaud/compile.c	Fri Jul 30 00:23:05 2021 +0000
+++ b/ffstools/tiaud/compile.c	Fri Jul 30 00:50:47 2021 +0000
@@ -16,6 +16,7 @@
 #include "binstruct.h"
 
 struct audio_cfg_bin bin;
+int is_new_aec;
 
 char *infname;
 FILE *inf;
@@ -562,20 +563,20 @@
 }
 
 static void
-aec_setting(args)
-	char *args;
+aec_setting(name, nwords, args)
+	char *name, *args;
 {
 	char *cp, *np;
 	int n;
 
 	cp = args;
-	for (n = 0; n < 5; n++) {
+	for (n = 0; n < nwords; n++) {
 		while (isspace(*cp))
 			cp++;
 		if (*cp == '\0' || *cp == '#') {
 argcount_err:		fprintf(stderr,
-				"%s line %d: aec setting takes 5 arguments\n",
-				infname, lineno);
+				"%s line %d: %s setting takes %d arguments\n",
+				infname, lineno, name, nwords);
 			exit(1);
 		}
 		for (np = cp; *cp && !isspace(*cp); cp++)
@@ -612,9 +613,13 @@
 			speaker_head_line(cp);
 		else if (!strcmp(np, "sidetone"))
 			sidetone_setting(cp);
-		else if (!strcmp(np, "aec"))
-			aec_setting(cp);
-		else {
+		else if (!strcmp(np, "aec")) {
+			is_new_aec = 0;
+			aec_setting("aec", 5, cp);
+		} else if (!strcmp(np, "aec-new")) {
+			is_new_aec = 1;
+			aec_setting("aec-new", 12, cp);
+		} else {
 			fprintf(stderr,
 			"%s line %d: unknown top-level setting \"%s\"\n",
 				infname, lineno, np);
@@ -633,7 +638,8 @@
 		perror(filename);
 		exit(1);
 	}
-	write(fd, &bin, MODE_FILE_SIZE_OLDAEC);
+	write(fd, &bin,
+	      is_new_aec ? MODE_FILE_SIZE_NEWAEC : MODE_FILE_SIZE_OLDAEC);
 	close(fd);
 }