comparison 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
comparison
equal deleted inserted replaced
154:01ce75ea1c8e 155:9814041e8096
1 /*
2 * Here we implement our PCM read helper function for "robe" format.
3 */
4
5 #include <stdio.h>
6 #include <stdint.h>
7 #include "roberead.h"
8
9 int robe_get_pcm_block(FILE *inf, int16_t *pcm)
10 {
11 uint8_t bytes[320], *dp;
12 int cc, i;
13
14 cc = fread(bytes, 1, 320, inf);
15 cc >>= 1;
16 dp = bytes;
17 for (i = 0; i < cc; i++) {
18 pcm[i] = (dp[0] << 8) | dp[1];
19 dp += 2;
20 }
21 while (i < 160)
22 pcm[i++] = 0;
23 return cc;
24 }