diff libtest/roberead.c @ 155:9814041e8096

gsmfr-encode-r utility put together
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 15 Dec 2022 01:30:59 +0000
parents libtest/robewrite.h@14b627682458
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libtest/roberead.c	Thu Dec 15 01:30:59 2022 +0000
@@ -0,0 +1,24 @@
+/*
+ * Here we implement our PCM read helper function for "robe" format.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include "roberead.h"
+
+int robe_get_pcm_block(FILE *inf, int16_t *pcm)
+{
+	uint8_t bytes[320], *dp;
+	int cc, i;
+
+	cc = fread(bytes, 1, 320, inf);
+	cc >>= 1;
+	dp = bytes;
+	for (i = 0; i < cc; i++) {
+		pcm[i] = (dp[0] << 8) | dp[1];
+		dp += 2;
+	}
+	while (i < 160)
+		pcm[i++] = 0;
+	return cc;
+}