changeset 241:1f3b28d66d53

tiaud-mkvol program written
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 25 Aug 2017 23:57:32 +0000
parents 2568a2a8a453
children f943c439ae5e
files .hgignore ffstools/tiaud/Makefile ffstools/tiaud/mkvol.c
diffstat 3 files changed, 45 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Fri Aug 25 23:36:07 2017 +0000
+++ b/.hgignore	Fri Aug 25 23:57:32 2017 +0000
@@ -8,6 +8,7 @@
 ^ffstools/cal2text/fc-cal2text$
 ^ffstools/tiaud/compile$
 ^ffstools/tiaud/decomp$
+^ffstools/tiaud/mkvol$
 ^ffstools/tiffs-rd/tiffs$
 ^ffstools/tiffs-wrappers/mokoffs$
 ^ffstools/tiffs-wrappers/pirffs$
--- a/ffstools/tiaud/Makefile	Fri Aug 25 23:36:07 2017 +0000
+++ b/ffstools/tiaud/Makefile	Fri Aug 25 23:57:32 2017 +0000
@@ -1,6 +1,6 @@
 CC=	gcc
 CFLAGS=	-O2
-PROGS=	compile decomp
+PROGS=	compile decomp mkvol
 INSTBIN=/opt/freecalypso/bin
 
 all:	${PROGS}
@@ -11,10 +11,14 @@
 decomp:	decomp.c
 	${CC} ${CFLAGS} -o $@ $@.c
 
+mkvol:	mkvol.c
+	${CC} ${CFLAGS} -o $@ $@.c
+
 install:	${PROGS}
 	mkdir -p ${INSTBIN}
 	install -c compile ${INSTBIN}/tiaud-compile
 	install -c decomp ${INSTBIN}/tiaud-decomp
+	install -c mkvol ${INSTBIN}/tiaud-mkvol
 
 clean:
 	rm -f ${PROGS}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ffstools/tiaud/mkvol.c	Fri Aug 25 23:57:32 2017 +0000
@@ -0,0 +1,39 @@
+/*
+ * This program generates an audio volume file for uploading into Calypso
+ * device FFS; TI's Audio Service requires every *.cfg file to be accompanied
+ * by a corresponding *.vol file.
+ */
+
+#include <sys/types.h>
+#include <sys/file.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+u_char bin[4];
+
+write_bin_output(filename)
+	char *filename;
+{
+	int fd;
+
+	fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666);
+	if (fd < 0) {
+		perror(filename);
+		exit(1);
+	}
+	write(fd, &bin, sizeof bin);
+	close(fd);
+}
+
+main(argc, argv)
+	char **argv;
+{
+	if (argc != 3) {
+		fprintf(stderr, "usage: %s volume outfile\n", argv[0]);
+		exit(1);
+	}
+	bin[0] = atoi(argv[1]);
+	write_bin_output(argv[2]);
+	exit(0);
+}